From ac779af339a19948c5d24cc7d985dc48981fc1df Mon Sep 17 00:00:00 2001 From: Sebastian Kupke Date: Wed, 24 Feb 2021 16:13:50 +0100 Subject: [PATCH] Popup close buttons can take a URL. --- dist/iwmlib.3rdparty.js | 38812 +++++++--------- dist/iwmlib.3rdparty.min.js | 2 +- dist/iwmlib.js | 78 +- dist/iwmlib.pixi.js | 100 +- doc/out/AbstractPopup.html | 394 +- doc/out/Badge.html | 394 +- doc/out/BlurFilter.html | 394 +- doc/out/Button.html | 402 +- doc/out/ButtonGroup.html | 394 +- doc/out/DeepZoomImage.html | 394 +- doc/out/DeepZoomInfo.html | 394 +- doc/out/Flippable.html | 394 +- doc/out/FontInfo.html | 392 +- doc/out/Hypenate.html | 392 +- doc/out/InteractivePopup.html | 401 +- ...beledGraphics.exports.LabeledGraphics.html | 392 +- doc/out/LabeledGraphics.html | 392 +- doc/out/List.html | 394 +- doc/out/Message.html | 404 +- doc/out/Modal.html | 404 +- doc/out/PIXIApp.html | 394 +- doc/out/Popup.html | 411 +- doc/out/PopupMenu.html | 412 +- doc/out/Progress.html | 394 +- doc/out/Scrollview.html | 398 +- doc/out/Slider.html | 394 +- doc/out/Switch.html | 394 +- doc/out/TextLabel.TextLabel.html | 392 +- doc/out/Theme.html | 394 +- doc/out/ThemeDark.html | 392 +- doc/out/ThemeLight.html | 394 +- doc/out/ThemeRed.html | 394 +- doc/out/TileQuadNode.html | 394 +- doc/out/Tooltip.html | 394 +- doc/out/UITest.html | 394 +- doc/out/Volatile.html | 394 +- doc/out/global.html | 392 +- doc/out/index.html | 392 +- doc/out/pixi_abstractpopup.js.html | 392 +- doc/out/pixi_app.js.html | 392 +- doc/out/pixi_badge.js.html | 392 +- doc/out/pixi_blurfilter.js.html | 392 +- doc/out/pixi_button.js.html | 414 +- doc/out/pixi_buttongroup.js.html | 392 +- doc/out/pixi_deepzoom_image.js.html | 392 +- doc/out/pixi_flippable.js.html | 392 +- doc/out/pixi_labeledgraphics.js.html | 392 +- doc/out/pixi_list.js.html | 392 +- doc/out/pixi_message.js.html | 392 +- doc/out/pixi_modal.js.html | 392 +- doc/out/pixi_popup.js.html | 419 +- doc/out/pixi_popupmenu.js.html | 392 +- doc/out/pixi_progress.js.html | 392 +- doc/out/pixi_scrollview.js.html | 392 +- doc/out/pixi_slider.js.html | 392 +- doc/out/pixi_switch.js.html | 392 +- doc/out/pixi_theme.js.html | 392 +- doc/out/pixi_tooltip.js.html | 392 +- doc/out/pixi_volatile.js.html | 392 +- doc/out/uitest.js.html | 392 +- lib/card/card.js | 6 +- lib/card/wrapper.js | 8 +- lib/errors.js | 4 +- lib/pixi/popup.js | 27 +- lib/pixi/scatter.js | 1 - lib/popupmenu.js | 11 +- lib/utils.js | 37 +- package.json | 2 +- 68 files changed, 18129 insertions(+), 43086 deletions(-) diff --git a/dist/iwmlib.3rdparty.js b/dist/iwmlib.3rdparty.js index 7acb20d..12efc1a 100644 --- a/dist/iwmlib.3rdparty.js +++ b/dist/iwmlib.3rdparty.js @@ -4355,8 +4355,8 @@ if (typeof define === 'function' && define.amd) { })); /*! - * pixi.js - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * pixi.js - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * pixi.js is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -4827,167 +4827,120 @@ var PIXI = (function (exports) { }; /*! - * @pixi/polyfill - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/polyfill - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/polyfill is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ // Support for IE 9 - 11 which does not include Promises - if (!window.Promise) - { + if (!window.Promise) { window.Promise = promise_2; } // References: - - if (!Object.assign) - { + if (!Object.assign) { Object.assign = objectAssign; } - var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - // References: // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ // https://gist.github.com/1579671 // http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision // https://gist.github.com/timhall/4078614 // https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame - // Expected to be used with Browserfiy // Browserify automatically detects the use of `global` and passes the // correct reference of `global`, `self`, and finally `window` - var ONE_FRAME_TIME = 16; - // Date.now - if (!(Date.now && Date.prototype.getTime)) - { - Date.now = function now() - { + if (!(Date.now && Date.prototype.getTime)) { + Date.now = function now() { return new Date().getTime(); }; } - // performance.now - if (!(commonjsGlobal$1.performance && commonjsGlobal$1.performance.now)) - { - var startTime = Date.now(); - - if (!commonjsGlobal$1.performance) - { - commonjsGlobal$1.performance = {}; + if (!(window.performance && window.performance.now)) { + var startTime_1 = Date.now(); + if (!window.performance) { + window.performance = {}; } - - commonjsGlobal$1.performance.now = function () { return Date.now() - startTime; }; + window.performance.now = function () { return Date.now() - startTime_1; }; } - // requestAnimationFrame var lastTime = Date.now(); var vendors = ['ms', 'moz', 'webkit', 'o']; - - for (var x = 0; x < vendors.length && !commonjsGlobal$1.requestAnimationFrame; ++x) - { + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { var p = vendors[x]; - - commonjsGlobal$1.requestAnimationFrame = commonjsGlobal$1[(p + "RequestAnimationFrame")]; - commonjsGlobal$1.cancelAnimationFrame = commonjsGlobal$1[(p + "CancelAnimationFrame")] || commonjsGlobal$1[(p + "CancelRequestAnimationFrame")]; + window.requestAnimationFrame = window[p + "RequestAnimationFrame"]; + window.cancelAnimationFrame = window[p + "CancelAnimationFrame"] + || window[p + "CancelRequestAnimationFrame"]; } - - if (!commonjsGlobal$1.requestAnimationFrame) - { - commonjsGlobal$1.requestAnimationFrame = function (callback) { - if (typeof callback !== 'function') - { - throw new TypeError((callback + "is not a function")); + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = function (callback) { + if (typeof callback !== 'function') { + throw new TypeError(callback + "is not a function"); } - var currentTime = Date.now(); var delay = ONE_FRAME_TIME + lastTime - currentTime; - - if (delay < 0) - { + if (delay < 0) { delay = 0; } - lastTime = currentTime; - - return setTimeout(function () { + return window.setTimeout(function () { lastTime = Date.now(); callback(performance.now()); }, delay); }; } - - if (!commonjsGlobal$1.cancelAnimationFrame) - { - commonjsGlobal$1.cancelAnimationFrame = function (id) { return clearTimeout(id); }; + if (!window.cancelAnimationFrame) { + window.cancelAnimationFrame = function (id) { return clearTimeout(id); }; } // References: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign - - if (!Math.sign) - { - Math.sign = function mathSign(x) - { + if (!Math.sign) { + Math.sign = function mathSign(x) { x = Number(x); - - if (x === 0 || isNaN(x)) - { + if (x === 0 || isNaN(x)) { return x; } - return x > 0 ? 1 : -1; }; } // References: // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger - - if (!Number.isInteger) - { - Number.isInteger = function numberIsInteger(value) - { + if (!Number.isInteger) { + Number.isInteger = function numberIsInteger(value) { return typeof value === 'number' && isFinite(value) && Math.floor(value) === value; }; } - if (!window.ArrayBuffer) - { + if (!window.ArrayBuffer) { window.ArrayBuffer = Array; } - - if (!window.Float32Array) - { + if (!window.Float32Array) { window.Float32Array = Array; } - - if (!window.Uint32Array) - { + if (!window.Uint32Array) { window.Uint32Array = Array; } - - if (!window.Uint16Array) - { + if (!window.Uint16Array) { window.Uint16Array = Array; } - - if (!window.Uint8Array) - { + if (!window.Uint8Array) { window.Uint8Array = Array; } - - if (!window.Int32Array) - { + if (!window.Int32Array) { window.Int32Array = Array; } var appleIphone = /iPhone/i; var appleIpod = /iPod/i; var appleTablet = /iPad/i; + var appleUniversal = /\biOS-universal(?:.+)Mac\b/i; var androidPhone = /\bAndroid(?:.+)Mobile\b/i; var androidTablet = /Android/i; var amazonPhone = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i; @@ -4999,12 +4952,40 @@ var PIXI = (function (exports) { var otherOpera = /Opera Mini/i; var otherChrome = /\b(CriOS|Chrome)(?:.+)Mobile/i; var otherFirefox = /Mobile(?:.+)Firefox\b/i; - function match(regex, userAgent) { - return regex.test(userAgent); + var isAppleTabletOnIos13 = function (navigator) { + return (typeof navigator !== 'undefined' && + navigator.platform === 'MacIntel' && + typeof navigator.maxTouchPoints === 'number' && + navigator.maxTouchPoints > 1 && + typeof MSStream === 'undefined'); + }; + function createMatch(userAgent) { + return function (regex) { return regex.test(userAgent); }; } - function isMobile(userAgent) { - userAgent = - userAgent || (typeof navigator !== 'undefined' ? navigator.userAgent : ''); + function isMobile(param) { + var nav = { + userAgent: '', + platform: '', + maxTouchPoints: 0 + }; + if (!param && typeof navigator !== 'undefined') { + nav = { + userAgent: navigator.userAgent, + platform: navigator.platform, + maxTouchPoints: navigator.maxTouchPoints || 0 + }; + } + else if (typeof param === 'string') { + nav.userAgent = param; + } + else if (param && param.userAgent) { + nav = { + userAgent: param.userAgent, + platform: param.platform, + maxTouchPoints: param.maxTouchPoints || 0 + }; + } + var userAgent = nav.userAgent; var tmp = userAgent.split('[FBAN'); if (typeof tmp[1] !== 'undefined') { userAgent = tmp[0]; @@ -5013,57 +4994,61 @@ var PIXI = (function (exports) { if (typeof tmp[1] !== 'undefined') { userAgent = tmp[0]; } + var match = createMatch(userAgent); var result = { apple: { - phone: match(appleIphone, userAgent) && !match(windowsPhone, userAgent), - ipod: match(appleIpod, userAgent), - tablet: !match(appleIphone, userAgent) && - match(appleTablet, userAgent) && - !match(windowsPhone, userAgent), - device: (match(appleIphone, userAgent) || - match(appleIpod, userAgent) || - match(appleTablet, userAgent)) && - !match(windowsPhone, userAgent), + phone: match(appleIphone) && !match(windowsPhone), + ipod: match(appleIpod), + tablet: !match(appleIphone) && + (match(appleTablet) || isAppleTabletOnIos13(nav)) && + !match(windowsPhone), + universal: match(appleUniversal), + device: (match(appleIphone) || + match(appleIpod) || + match(appleTablet) || + match(appleUniversal) || + isAppleTabletOnIos13(nav)) && + !match(windowsPhone) }, amazon: { - phone: match(amazonPhone, userAgent), - tablet: !match(amazonPhone, userAgent) && match(amazonTablet, userAgent), - device: match(amazonPhone, userAgent) || match(amazonTablet, userAgent), + phone: match(amazonPhone), + tablet: !match(amazonPhone) && match(amazonTablet), + device: match(amazonPhone) || match(amazonTablet) }, android: { - phone: (!match(windowsPhone, userAgent) && match(amazonPhone, userAgent)) || - (!match(windowsPhone, userAgent) && match(androidPhone, userAgent)), - tablet: !match(windowsPhone, userAgent) && - !match(amazonPhone, userAgent) && - !match(androidPhone, userAgent) && - (match(amazonTablet, userAgent) || match(androidTablet, userAgent)), - device: (!match(windowsPhone, userAgent) && - (match(amazonPhone, userAgent) || - match(amazonTablet, userAgent) || - match(androidPhone, userAgent) || - match(androidTablet, userAgent))) || - match(/\bokhttp\b/i, userAgent), + phone: (!match(windowsPhone) && match(amazonPhone)) || + (!match(windowsPhone) && match(androidPhone)), + tablet: !match(windowsPhone) && + !match(amazonPhone) && + !match(androidPhone) && + (match(amazonTablet) || match(androidTablet)), + device: (!match(windowsPhone) && + (match(amazonPhone) || + match(amazonTablet) || + match(androidPhone) || + match(androidTablet))) || + match(/\bokhttp\b/i) }, windows: { - phone: match(windowsPhone, userAgent), - tablet: match(windowsTablet, userAgent), - device: match(windowsPhone, userAgent) || match(windowsTablet, userAgent), + phone: match(windowsPhone), + tablet: match(windowsTablet), + device: match(windowsPhone) || match(windowsTablet) }, other: { - blackberry: match(otherBlackBerry, userAgent), - blackberry10: match(otherBlackBerry10, userAgent), - opera: match(otherOpera, userAgent), - firefox: match(otherFirefox, userAgent), - chrome: match(otherChrome, userAgent), - device: match(otherBlackBerry, userAgent) || - match(otherBlackBerry10, userAgent) || - match(otherOpera, userAgent) || - match(otherFirefox, userAgent) || - match(otherChrome, userAgent), + blackberry: match(otherBlackBerry), + blackberry10: match(otherBlackBerry10), + opera: match(otherOpera), + firefox: match(otherFirefox), + chrome: match(otherChrome), + device: match(otherBlackBerry) || + match(otherBlackBerry10) || + match(otherOpera) || + match(otherFirefox) || + match(otherChrome) }, any: false, phone: false, - tablet: false, + tablet: false }; result.any = result.apple.device || @@ -5078,16 +5063,15 @@ var PIXI = (function (exports) { } /*! - * @pixi/settings - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/settings - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/settings is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ // The ESM/CJS versions of ismobilejs only - - var isMobile$1 = isMobile(); + var isMobile$1 = isMobile(window.navigator); /** * The maximum recommended texture units to use. @@ -5102,46 +5086,30 @@ var PIXI = (function (exports) { * @param {number} max * @returns {number} */ - function maxRecommendedTextures(max) - { + function maxRecommendedTextures(max) { var allowMax = true; - - if (isMobile$1.tablet || isMobile$1.phone) - { - allowMax = false; - - if (isMobile$1.apple.device) - { + if (isMobile$1.tablet || isMobile$1.phone) { + if (isMobile$1.apple.device) { var match = (navigator.userAgent).match(/OS (\d+)_(\d+)?/); - - if (match) - { + if (match) { var majorVersion = parseInt(match[1], 10); - - // All texture units can be used on devices that support ios 11 or above - if (majorVersion >= 11) - { - allowMax = true; + // Limit texture units on devices below iOS 11, which will be older hardware + if (majorVersion < 11) { + allowMax = false; } } } - if (isMobile$1.android.device) - { - var match$1 = (navigator.userAgent).match(/Android\s([0-9.]*)/); - - if (match$1) - { - var majorVersion$1 = parseInt(match$1[1], 10); - - // All texture units can be used on devices that support Android 7 (Nougat) or above - if (majorVersion$1 >= 7) - { - allowMax = true; + if (isMobile$1.android.device) { + var match = (navigator.userAgent).match(/Android\s([0-9.]*)/); + if (match) { + var majorVersion = parseInt(match[1], 10); + // Limit texture units on devices below Android 7 (Nougat), which will be older hardware + if (majorVersion < 7) { + allowMax = false; } } } } - return allowMax ? max : 4; } @@ -5153,8 +5121,7 @@ var PIXI = (function (exports) { * @private * @returns {boolean} */ - function canUploadSameBuffer() - { + function canUploadSameBuffer() { return !isMobile$1.apple.device; } @@ -5171,7 +5138,6 @@ var PIXI = (function (exports) { * @namespace PIXI.settings */ var settings = { - /** * If set to true WebGL will attempt make textures mimpaped by default. * Mipmapping will only succeed if the base texture uploaded has power of two dimensions. @@ -5183,7 +5149,6 @@ var PIXI = (function (exports) { * @default PIXI.MIPMAP_MODES.POW2 */ MIPMAP_TEXTURES: 1, - /** * Default anisotropic filtering level of textures. * Usually from 0 to 16 @@ -5195,7 +5160,6 @@ var PIXI = (function (exports) { * @default 0 */ ANISOTROPIC_LEVEL: 0, - /** * Default resolution / device pixel ratio of the renderer. * @@ -5206,7 +5170,6 @@ var PIXI = (function (exports) { * @default 1 */ RESOLUTION: 1, - /** * Default filter resolution. * @@ -5217,7 +5180,6 @@ var PIXI = (function (exports) { * @default 1 */ FILTER_RESOLUTION: 1, - /** * The maximum textures that this device supports. * @@ -5228,10 +5190,8 @@ var PIXI = (function (exports) { * @default 32 */ SPRITE_MAX_TEXTURES: maxRecommendedTextures(32), - // TODO: maybe change to SPRITE.BATCH_SIZE: 2000 // TODO: maybe add PARTICLE.BATCH_SIZE: 15000 - /** * The default sprite batch size. * @@ -5244,7 +5204,6 @@ var PIXI = (function (exports) { * @default 4096 */ SPRITE_BATCH_SIZE: 4096, - /** * The default render options if none are supplied to {@link PIXI.Renderer} * or {@link PIXI.CanvasRenderer}. @@ -5256,7 +5215,6 @@ var PIXI = (function (exports) { * @property {HTMLCanvasElement} view=null * @property {number} resolution=1 * @property {boolean} antialias=false - * @property {boolean} forceFXAA=false * @property {boolean} autoDensity=false * @property {boolean} transparent=false * @property {number} backgroundColor=0x000000 @@ -5269,7 +5227,6 @@ var PIXI = (function (exports) { RENDER_OPTIONS: { view: null, antialias: false, - forceFXAA: false, autoDensity: false, transparent: false, backgroundColor: 0x000000, @@ -5279,7 +5236,6 @@ var PIXI = (function (exports) { height: 600, legacy: false, }, - /** * Default Garbage Collection mode. * @@ -5290,7 +5246,6 @@ var PIXI = (function (exports) { * @default PIXI.GC_MODES.AUTO */ GC_MODE: 0, - /** * Default Garbage Collection max idle. * @@ -5301,7 +5256,6 @@ var PIXI = (function (exports) { * @default 3600 */ GC_MAX_IDLE: 60 * 60, - /** * Default Garbage Collection maximum check count. * @@ -5312,7 +5266,6 @@ var PIXI = (function (exports) { * @default 600 */ GC_MAX_CHECK_COUNT: 60 * 10, - /** * Default wrap modes that are supported by pixi. * @@ -5323,7 +5276,6 @@ var PIXI = (function (exports) { * @default PIXI.WRAP_MODES.CLAMP */ WRAP_MODE: 33071, - /** * Default scale mode for textures. * @@ -5334,7 +5286,6 @@ var PIXI = (function (exports) { * @default PIXI.SCALE_MODES.LINEAR */ SCALE_MODE: 1, - /** * Default specify float precision in vertex shader. * @@ -5345,7 +5296,6 @@ var PIXI = (function (exports) { * @default PIXI.PRECISION.HIGH */ PRECISION_VERTEX: 'highp', - /** * Default specify float precision in fragment shader. * iOS is best set at highp due to https://github.com/pixijs/pixi.js/issues/3742 @@ -5357,7 +5307,6 @@ var PIXI = (function (exports) { * @default PIXI.PRECISION.MEDIUM */ PRECISION_FRAGMENT: isMobile$1.apple.device ? 'highp' : 'mediump', - /** * Can we upload the same buffer in a single frame? * @@ -5367,7 +5316,6 @@ var PIXI = (function (exports) { * @type {boolean} */ CAN_UPLOAD_SAME_BUFFER: canUploadSameBuffer(), - /** * Enables bitmap creation before image load. This feature is experimental. * @@ -5378,7 +5326,6 @@ var PIXI = (function (exports) { * @default false */ CREATE_IMAGE_BITMAP: false, - /** * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. * Advantages can include sharper image quality (like text) and faster rendering on canvas. @@ -7867,8 +7814,8 @@ var PIXI = (function (exports) { }; /*! - * @pixi/constants - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/constants - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/constants is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -7908,6 +7855,23 @@ var PIXI = (function (exports) { RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; })(exports.RENDERER_TYPE || (exports.RENDERER_TYPE = {})); + /** + * Bitwise OR of masks that indicate the buffers to be cleared. + * + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ + + (function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; + })(exports.BUFFER_BITS || (exports.BUFFER_BITS = {})); /** * Various blend modes supported by PIXI. * @@ -8182,6 +8146,29 @@ var PIXI = (function (exports) { ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; })(exports.ALPHA_MODES || (exports.ALPHA_MODES = {})); + /** + * How to clear renderTextures in filter + * + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Preserve the information in the texture, blend above + * @property {number} CLEAR - Must use `gl.clear` operation + * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ + + (function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; + })(exports.CLEAR_MODES || (exports.CLEAR_MODES = {})); /** * The gc modes that are supported by pixi. * @@ -8244,10 +8231,31 @@ var PIXI = (function (exports) { MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; })(exports.MASK_TYPES || (exports.MASK_TYPES = {})); + /** + * Constants for multi-sampling antialiasing. + * + * @see PIXI.Framebuffer#multisample + * + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ + + (function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; + })(exports.MSAA_QUALITY || (exports.MSAA_QUALITY = {})); /*! - * @pixi/utils - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/utils - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/utils is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -8278,7 +8286,7 @@ var PIXI = (function (exports) { settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = true; var saidHello = false; - var VERSION = '5.2.1'; + var VERSION = '5.3.3'; /** * Skips the hello message of renderers that are created after this is run. * @@ -8371,11 +8379,11 @@ var PIXI = (function (exports) { * @memberof PIXI.utils * @function hex2rgb * @param {number} hex - The hexadecimal number to convert - * @param {number[]} [out=[]] If supplied, this array will be used rather than returning a new one + * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one * @return {number[]} An array representing the [R, G, B] of the color where all values are floats. */ function hex2rgb(hex, out) { - out = out || []; + if (out === void 0) { out = []; } out[0] = ((hex >> 16) & 0xFF) / 255; out[1] = ((hex >> 8) & 0xFF) / 255; out[2] = (hex & 0xFF) / 255; @@ -8403,7 +8411,7 @@ var PIXI = (function (exports) { * PIXI.utils.string2hex("#ffffff"); // returns 0xffffff * @memberof PIXI.utils * @function string2hex - * @param {string} The string color (e.g., `"#ffffff"`) + * @param {string} string - The string color (e.g., `"#ffffff"`) * @return {number} Number in hexadecimal. */ function string2hex(string) { @@ -8464,8 +8472,8 @@ var PIXI = (function (exports) { * * @memberof PIXI.utils * @function correctBlendMode - * @param {number} blendMode supposed blend mode - * @param {boolean} premultiplied whether source is premultiplied + * @param {number} blendMode - supposed blend mode + * @param {boolean} premultiplied - whether source is premultiplied * @returns {number} true blend mode for this texture */ function correctBlendMode(blendMode, premultiplied) { @@ -8476,10 +8484,10 @@ var PIXI = (function (exports) { * * @memberof PIXI.utils * @function premultiplyRgba - * @param {Float32Array|number[]} rgb input rgb - * @param {number} alpha alpha param - * @param {Float32Array} [out] output - * @param {boolean} [premultiply=true] do premultiply it + * @param {Float32Array|number[]} rgb - input rgb + * @param {number} alpha - alpha param + * @param {Float32Array} [out] - output + * @param {boolean} [premultiply=true] - do premultiply it * @returns {Float32Array} vec4 rgba */ function premultiplyRgba(rgb, alpha, out, premultiply) { @@ -8502,8 +8510,8 @@ var PIXI = (function (exports) { * * @memberof PIXI.utils * @function premultiplyTint - * @param {number} tint integer RGB - * @param {number} alpha floating point alpha (0.0-1.0) + * @param {number} tint - integer RGB + * @param {number} alpha - floating point alpha (0.0-1.0) * @returns {number} tint multiplied by alpha */ function premultiplyTint(tint, alpha) { @@ -8526,10 +8534,10 @@ var PIXI = (function (exports) { * * @memberof PIXI.utils * @function premultiplyTintToRgba - * @param {number} tint input tint - * @param {number} alpha alpha param + * @param {number} tint - input tint + * @param {number} alpha - alpha param * @param {Float32Array} [out] output - * @param {boolean} [premultiply=true] do premultiply it + * @param {boolean} [premultiply=true] - do premultiply it * @returns {Float32Array} vec4 rgba */ function premultiplyTintToRgba(tint, alpha, out, premultiply) { @@ -8640,7 +8648,7 @@ var PIXI = (function (exports) { * * @function nextPow2 * @memberof PIXI.utils - * @param {number} v input value + * @param {number} v - input value * @return {number} */ function nextPow2(v) { @@ -8658,7 +8666,7 @@ var PIXI = (function (exports) { * * @function isPow2 * @memberof PIXI.utils - * @param {number} v input value + * @param {number} v - input value * @return {boolean} `true` if value is power of two */ function isPow2(v) { @@ -8669,7 +8677,7 @@ var PIXI = (function (exports) { * * @function log2 * @memberof PIXI.utils - * @param {number} v input value + * @param {number} v - input value * @return {number} logarithm base 2 */ function log2(v) { @@ -8692,9 +8700,9 @@ var PIXI = (function (exports) { * * @function removeItems * @memberof PIXI.utils - * @param {Array} arr Array to remove elements from - * @param {number} startIdx starting index - * @param {number} removeCount how many to remove + * @param {Array} arr - Array to remove elements from + * @param {number} startIdx - starting index + * @param {number} removeCount - how many to remove */ function removeItems(arr, startIdx, removeCount) { var length = arr.length; @@ -8904,7 +8912,7 @@ var PIXI = (function (exports) { set: function (val) { this.canvas.width = val; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(CanvasRenderTarget.prototype, "height", { @@ -8919,7 +8927,7 @@ var PIXI = (function (exports) { set: function (val) { this.canvas.height = val; }, - enumerable: true, + enumerable: false, configurable: true }); return CanvasRenderTarget; @@ -9147,27 +9155,685 @@ var PIXI = (function (exports) { }); /*! - * @pixi/math - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/math - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/math is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /** + * Two Pi. + * + * @static + * @constant {number} PI_2 + * @memberof PIXI + */ + var PI_2 = Math.PI * 2; + /** + * Conversion factor for converting radians to degrees. + * + * @static + * @constant {number} RAD_TO_DEG + * @memberof PIXI + */ + var RAD_TO_DEG = 180 / Math.PI; + /** + * Conversion factor for converting degrees to radians. + * + * @static + * @constant {number} DEG_TO_RAD + * @memberof PIXI + */ + var DEG_TO_RAD = Math.PI / 180; + + (function (SHAPES) { + SHAPES[SHAPES["POLY"] = 0] = "POLY"; + SHAPES[SHAPES["RECT"] = 1] = "RECT"; + SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; + SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; + SHAPES[SHAPES["RREC"] = 4] = "RREC"; + })(exports.SHAPES || (exports.SHAPES = {})); + /** + * Constants that identify shapes, mainly to prevent `instanceof` calls. + * + * @static + * @constant + * @name SHAPES + * @memberof PIXI + * @type {enum} + * @property {number} POLY Polygon + * @property {number} RECT Rectangle + * @property {number} CIRC Circle + * @property {number} ELIP Ellipse + * @property {number} RREC Rounded Rectangle + * @enum {number} + */ + + /** + * Size object, contains width and height + * + * @memberof PIXI + * @typedef {object} ISize + * @property {number} width - Width component + * @property {number} height - Height component + */ + /** + * Rectangle object is an area defined by its position, as indicated by its top-left corner + * point (x, y) and by its width and its height. + * + * @class + * @memberof PIXI + */ + var Rectangle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle + * @param {number} [width=0] - The overall width of this rectangle + * @param {number} [height=0] - The overall height of this rectangle + */ + function Rectangle(x, y, width, height) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = Number(x); + /** + * @member {number} + * @default 0 + */ + this.y = Number(y); + /** + * @member {number} + * @default 0 + */ + this.width = Number(width); + /** + * @member {number} + * @default 0 + */ + this.height = Number(height); + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.RECT + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.RECT; + } + Object.defineProperty(Rectangle.prototype, "left", { + /** + * returns the left edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.x; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "right", { + /** + * returns the right edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.x + this.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "top", { + /** + * returns the top edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.y; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle.prototype, "bottom", { + /** + * returns the bottom edge of the rectangle + * + * @member {number} + */ + get: function () { + return this.y + this.height; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Rectangle, "EMPTY", { + /** + * A constant empty rectangle. + * + * @static + * @constant + * @member {PIXI.Rectangle} + * @return {PIXI.Rectangle} An empty rectangle + */ + get: function () { + return new Rectangle(0, 0, 0, 0); + }, + enumerable: false, + configurable: true + }); + /** + * Creates a clone of this Rectangle + * + * @return {PIXI.Rectangle} a copy of the rectangle + */ + Rectangle.prototype.clone = function () { + return new Rectangle(this.x, this.y, this.width, this.height); + }; + /** + * Copies another rectangle to this one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to copy from. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.copyFrom = function (rectangle) { + this.x = rectangle.x; + this.y = rectangle.y; + this.width = rectangle.width; + this.height = rectangle.height; + return this; + }; + /** + * Copies this rectangle to another one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to copy to. + * @return {PIXI.Rectangle} Returns given parameter. + */ + Rectangle.prototype.copyTo = function (rectangle) { + rectangle.x = this.x; + rectangle.y = this.y; + rectangle.width = this.width; + rectangle.height = this.height; + return rectangle; + }; + /** + * Checks whether the x and y coordinates given are contained within this Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rectangle + */ + Rectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x < this.x + this.width) { + if (y >= this.y && y < this.y + this.height) { + return true; + } + } + return false; + }; + /** + * Pads the rectangle making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * + * @param {number} [paddingX=0] - The horizontal padding amount. + * @param {number} [paddingY=0] - The vertical padding amount. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + this.x -= paddingX; + this.y -= paddingY; + this.width += paddingX * 2; + this.height += paddingY * 2; + return this; + }; + /** + * Fits this rectangle around the passed one. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to fit. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.fit = function (rectangle) { + var x1 = Math.max(this.x, rectangle.x); + var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.max(this.y, rectangle.y); + var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = Math.max(x2 - x1, 0); + this.y = y1; + this.height = Math.max(y2 - y1, 0); + return this; + }; + /** + * Enlarges rectangle that way its corners lie on grid + * + * @param {number} [resolution=1] resolution + * @param {number} [eps=0.001] precision + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.ceil = function (resolution, eps) { + if (resolution === void 0) { resolution = 1; } + if (eps === void 0) { eps = 0.001; } + var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; + var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; + this.x = Math.floor((this.x + eps) * resolution) / resolution; + this.y = Math.floor((this.y + eps) * resolution) / resolution; + this.width = x2 - this.x; + this.height = y2 - this.y; + return this; + }; + /** + * Enlarges this rectangle to include the passed rectangle. + * + * @param {PIXI.Rectangle} rectangle - The rectangle to include. + * @return {PIXI.Rectangle} Returns itself. + */ + Rectangle.prototype.enlarge = function (rectangle) { + var x1 = Math.min(this.x, rectangle.x); + var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); + var y1 = Math.min(this.y, rectangle.y); + var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; + return this; + }; + return Rectangle; + }()); + + /** + * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * + * @class + * @memberof PIXI + */ + var Circle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this circle + * @param {number} [y=0] - The Y coordinate of the center of this circle + * @param {number} [radius=0] - The radius of the circle + */ + function Circle(x, y, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (radius === void 0) { radius = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.radius = radius; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.CIRC + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.CIRC; + } + /** + * Creates a clone of this Circle instance + * + * @return {PIXI.Circle} a copy of the Circle + */ + Circle.prototype.clone = function () { + return new Circle(this.x, this.y, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this circle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Circle + */ + Circle.prototype.contains = function (x, y) { + if (this.radius <= 0) { + return false; + } + var r2 = this.radius * this.radius; + var dx = (this.x - x); + var dy = (this.y - y); + dx *= dx; + dy *= dy; + return (dx + dy <= r2); + }; + /** + * Returns the framing rectangle of the circle as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + Circle.prototype.getBounds = function () { + return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); + }; + return Circle; + }()); + + /** + * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. + * + * @class + * @memberof PIXI + */ + var Ellipse = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the center of this ellipse + * @param {number} [y=0] - The Y coordinate of the center of this ellipse + * @param {number} [halfWidth=0] - The half width of this ellipse + * @param {number} [halfHeight=0] - The half height of this ellipse + */ + function Ellipse(x, y, halfWidth, halfHeight) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (halfWidth === void 0) { halfWidth = 0; } + if (halfHeight === void 0) { halfHeight = 0; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.width = halfWidth; + /** + * @member {number} + * @default 0 + */ + this.height = halfHeight; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.ELIP + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.ELIP; + } + /** + * Creates a clone of this Ellipse instance + * + * @return {PIXI.Ellipse} a copy of the ellipse + */ + Ellipse.prototype.clone = function () { + return new Ellipse(this.x, this.y, this.width, this.height); + }; + /** + * Checks whether the x and y coordinates given are contained within this ellipse + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coords are within this ellipse + */ + Ellipse.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + // normalize the coords to an ellipse with center 0,0 + var normx = ((x - this.x) / this.width); + var normy = ((y - this.y) / this.height); + normx *= normx; + normy *= normy; + return (normx + normy <= 1); + }; + /** + * Returns the framing rectangle of the ellipse as a Rectangle object + * + * @return {PIXI.Rectangle} the framing rectangle + */ + Ellipse.prototype.getBounds = function () { + return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); + }; + return Ellipse; + }()); + + /** + * A class to define a shape via user defined co-orinates. + * + * @class + * @memberof PIXI + */ + var Polygon = /** @class */ (function () { + /** + * @param {PIXI.IPoint[]|number[]} points - This can be an array of Points + * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or + * the arguments passed can be all the points of the polygon e.g. + * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat + * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. + */ + function Polygon() { + var arguments$1 = arguments; + + var points = []; + for (var _i = 0; _i < arguments.length; _i++) { + points[_i] = arguments$1[_i]; + } + var flat = Array.isArray(points[0]) ? points[0] : points; + // if this is an array of points, convert it to a flat array of numbers + if (typeof flat[0] !== 'number') { + var p = []; + for (var i = 0, il = flat.length; i < il; i++) { + p.push(flat[i].x, flat[i].y); + } + flat = p; + } + /** + * An array of the points of this polygon + * + * @member {number[]} + */ + this.points = flat; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readOnly + * @default PIXI.SHAPES.POLY + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.POLY; + /** + * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. + * @member {boolean} + * @default true + */ + this.closeStroke = true; + } + /** + * Creates a clone of this polygon + * + * @return {PIXI.Polygon} a copy of the polygon + */ + Polygon.prototype.clone = function () { + var points = this.points.slice(); + var polygon = new Polygon(points); + polygon.closeStroke = this.closeStroke; + return polygon; + }; + /** + * Checks whether the x and y coordinates passed to this function are contained within this polygon + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this polygon + */ + Polygon.prototype.contains = function (x, y) { + var inside = false; + // use some raycasting to test hits + // https://github.com/substack/point-in-polygon/blob/master/index.js + var length = this.points.length / 2; + for (var i = 0, j = length - 1; i < length; j = i++) { + var xi = this.points[i * 2]; + var yi = this.points[(i * 2) + 1]; + var xj = this.points[j * 2]; + var yj = this.points[(j * 2) + 1]; + var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); + if (intersect) { + inside = !inside; + } + } + return inside; + }; + return Polygon; + }()); + + /** + * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its + * top-left corner point (x, y) and by its width and its height and its radius. + * + * @class + * @memberof PIXI + */ + var RoundedRectangle = /** @class */ (function () { + /** + * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle + * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle + * @param {number} [width=0] - The overall width of this rounded rectangle + * @param {number} [height=0] - The overall height of this rounded rectangle + * @param {number} [radius=20] - Controls the radius of the rounded corners + */ + function RoundedRectangle(x, y, width, height, radius) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + if (radius === void 0) { radius = 20; } + /** + * @member {number} + * @default 0 + */ + this.x = x; + /** + * @member {number} + * @default 0 + */ + this.y = y; + /** + * @member {number} + * @default 0 + */ + this.width = width; + /** + * @member {number} + * @default 0 + */ + this.height = height; + /** + * @member {number} + * @default 20 + */ + this.radius = radius; + /** + * The type of the object, mainly used to avoid `instanceof` checks + * + * @member {number} + * @readonly + * @default PIXI.SHAPES.RREC + * @see PIXI.SHAPES + */ + this.type = exports.SHAPES.RREC; + } + /** + * Creates a clone of this Rounded Rectangle + * + * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle + */ + RoundedRectangle.prototype.clone = function () { + return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); + }; + /** + * Checks whether the x and y coordinates given are contained within this Rounded Rectangle + * + * @param {number} x - The X coordinate of the point to test + * @param {number} y - The Y coordinate of the point to test + * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle + */ + RoundedRectangle.prototype.contains = function (x, y) { + if (this.width <= 0 || this.height <= 0) { + return false; + } + if (x >= this.x && x <= this.x + this.width) { + if (y >= this.y && y <= this.y + this.height) { + if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius) + || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) { + return true; + } + var dx = x - (this.x + this.radius); + var dy = y - (this.y + this.radius); + var radius2 = this.radius * this.radius; + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.width - this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dy = y - (this.y + this.height - this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + dx = x - (this.x + this.radius); + if ((dx * dx) + (dy * dy) <= radius2) { + return true; + } + } + } + return false; + }; + return RoundedRectangle; + }()); + /** * Common interface for points. Both Point and ObservablePoint implement it * @memberof PIXI - * @interface IPoint + * @interface IPointData */ /** * X coord - * @memberof PIXI.IPoint# + * @memberof PIXI.IPointData# * @member {number} x */ /** * Y coord - * @memberof PIXI.IPoint# + * @memberof PIXI.IPointData# * @member {number} y */ + + /** + * Common interface for points. Both Point and ObservablePoint implement it + * @memberof PIXI + * @interface IPoint + * @extends PIXI.IPointData + */ /** * Sets the point to a new x and y position. * If y is omitted, both x and y will be set to x. @@ -9181,7 +9847,7 @@ var PIXI = (function (exports) { * Copies x and y from the given point * @method copyFrom * @memberof PIXI.IPoint# - * @param {PIXI.IPoint} p - The point to copy from + * @param {PIXI.IPointData} p - The point to copy from * @returns {this} Returns itself. */ /** @@ -9196,7 +9862,7 @@ var PIXI = (function (exports) { * * @method equals * @memberof PIXI.IPoint# - * @param {PIXI.IPoint} p - The point to check + * @param {PIXI.IPointData} p - The point to check * @returns {boolean} Whether the given point equal to this point */ @@ -9238,7 +9904,7 @@ var PIXI = (function (exports) { /** * Copies x and y from the given point * - * @param {PIXI.IPoint} p - The point to copy from + * @param {PIXI.IPointData} p - The point to copy from * @returns {this} Returns itself. */ Point.prototype.copyFrom = function (p) { @@ -9258,7 +9924,7 @@ var PIXI = (function (exports) { /** * Returns true if the given point is equal to this point * - * @param {PIXI.IPoint} p - The point to check + * @param {PIXI.IPointData} p - The point to check * @returns {boolean} Whether the given point equal to this point */ Point.prototype.equals = function (p) { @@ -9343,7 +10009,7 @@ var PIXI = (function (exports) { /** * Copies x and y from the given point * - * @param {PIXI.IPoint} p - The point to copy from. + * @param {PIXI.IPointData} p - The point to copy from. * @returns {this} Returns itself. */ ObservablePoint.prototype.copyFrom = function (p) { @@ -9367,7 +10033,7 @@ var PIXI = (function (exports) { /** * Returns true if the given point is equal to this point * - * @param {PIXI.IPoint} p - The point to check + * @param {PIXI.IPointData} p - The point to check * @returns {boolean} Whether the given point equal to this point */ ObservablePoint.prototype.equals = function (p) { @@ -9388,7 +10054,7 @@ var PIXI = (function (exports) { this.cb.call(this.scope); } }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(ObservablePoint.prototype, "y", { @@ -9406,60 +10072,12 @@ var PIXI = (function (exports) { this.cb.call(this.scope); } }, - enumerable: true, + enumerable: false, configurable: true }); return ObservablePoint; }()); - /** - * Two Pi. - * - * @static - * @constant {number} PI_2 - * @memberof PIXI - */ - var PI_2 = Math.PI * 2; - /** - * Conversion factor for converting radians to degrees. - * - * @static - * @constant {number} RAD_TO_DEG - * @memberof PIXI - */ - var RAD_TO_DEG = 180 / Math.PI; - /** - * Conversion factor for converting degrees to radians. - * - * @static - * @constant {number} DEG_TO_RAD - * @memberof PIXI - */ - var DEG_TO_RAD = Math.PI / 180; - - (function (SHAPES) { - SHAPES[SHAPES["POLY"] = 0] = "POLY"; - SHAPES[SHAPES["RECT"] = 1] = "RECT"; - SHAPES[SHAPES["CIRC"] = 2] = "CIRC"; - SHAPES[SHAPES["ELIP"] = 3] = "ELIP"; - SHAPES[SHAPES["RREC"] = 4] = "RREC"; - })(exports.SHAPES || (exports.SHAPES = {})); - /** - * Constants that identify shapes, mainly to prevent `instanceof` calls. - * - * @static - * @constant - * @name SHAPES - * @memberof PIXI - * @type {enum} - * @property {number} POLY Polygon - * @property {number} RECT Rectangle - * @property {number} CIRC Circle - * @property {number} ELIP Ellipse - * @property {number} RREC Rounded Rectangle - * @enum {number} - */ - /** * The PixiJS Matrix as a class makes it a lot faster. * @@ -9601,12 +10219,12 @@ var PIXI = (function (exports) { * Get a new position with the current transformation applied. * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) * - * @param {PIXI.Point} pos - The origin + * @param {PIXI.IPointData} pos - The origin * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) * @return {PIXI.Point} The new point, transformed through this matrix */ Matrix.prototype.apply = function (pos, newPos) { - newPos = newPos || new Point(); + newPos = (newPos || new Point()); var x = pos.x; var y = pos.y; newPos.x = (this.a * x) + (this.c * y) + this.tx; @@ -9617,12 +10235,12 @@ var PIXI = (function (exports) { * Get a new position with the inverse of the current transformation applied. * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) * - * @param {PIXI.Point} pos - The origin + * @param {PIXI.IPointData} pos - The origin * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input) * @return {PIXI.Point} The new point, inverse-transformed through this matrix */ Matrix.prototype.applyInverse = function (pos, newPos) { - newPos = newPos || new Point(); + newPos = (newPos || new Point()); var id = 1 / ((this.a * this.d) + (this.c * -this.b)); var x = pos.x; var y = pos.y; @@ -9633,8 +10251,8 @@ var PIXI = (function (exports) { /** * Translates the matrix on the x and y. * - * @param {number} x How much to translate x by - * @param {number} y How much to translate y by + * @param {number} x - How much to translate x by + * @param {number} y - How much to translate y by * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ Matrix.prototype.translate = function (x, y) { @@ -9645,8 +10263,8 @@ var PIXI = (function (exports) { /** * Applies a scale transformation to the matrix. * - * @param {number} x The amount to scale horizontally - * @param {number} y The amount to scale vertically + * @param {number} x - The amount to scale horizontally + * @param {number} y - The amount to scale vertically * @return {PIXI.Matrix} This matrix. Good for chaining method calls. */ Matrix.prototype.scale = function (x, y) { @@ -9862,7 +10480,7 @@ var PIXI = (function (exports) { get: function () { return new Matrix(); }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Matrix, "TEMP_MATRIX", { @@ -9876,7 +10494,7 @@ var PIXI = (function (exports) { get: function () { return new Matrix(); }, - enumerable: true, + enumerable: false, configurable: true }); return Matrix; @@ -10431,7 +11049,7 @@ var PIXI = (function (exports) { this.updateSkew(); } }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -10445,615 +11063,9 @@ var PIXI = (function (exports) { return Transform; }()); - /** - * Size object, contains width and height - * - * @memberof PIXI - * @typedef {object} ISize - * @property {number} width - Width component - * @property {number} height - Height component - */ - /** - * Rectangle object is an area defined by its position, as indicated by its top-left corner - * point (x, y) and by its width and its height. - * - * @class - * @memberof PIXI - */ - var Rectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle - * @param {number} [width=0] - The overall width of this rectangle - * @param {number} [height=0] - The overall height of this rectangle - */ - function Rectangle(x, y, width, height) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = Number(x); - /** - * @member {number} - * @default 0 - */ - this.y = Number(y); - /** - * @member {number} - * @default 0 - */ - this.width = Number(width); - /** - * @member {number} - * @default 0 - */ - this.height = Number(height); - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.RECT - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RECT; - } - Object.defineProperty(Rectangle.prototype, "left", { - /** - * returns the left edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "right", { - /** - * returns the right edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.x + this.width; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "top", { - /** - * returns the top edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rectangle.prototype, "bottom", { - /** - * returns the bottom edge of the rectangle - * - * @member {number} - */ - get: function () { - return this.y + this.height; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rectangle, "EMPTY", { - /** - * A constant empty rectangle. - * - * @static - * @constant - * @member {PIXI.Rectangle} - * @return {PIXI.Rectangle} An empty rectangle - */ - get: function () { - return new Rectangle(0, 0, 0, 0); - }, - enumerable: true, - configurable: true - }); - /** - * Creates a clone of this Rectangle - * - * @return {PIXI.Rectangle} a copy of the rectangle - */ - Rectangle.prototype.clone = function () { - return new Rectangle(this.x, this.y, this.width, this.height); - }; - /** - * Copies another rectangle to this one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy from. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.copyFrom = function (rectangle) { - this.x = rectangle.x; - this.y = rectangle.y; - this.width = rectangle.width; - this.height = rectangle.height; - return this; - }; - /** - * Copies this rectangle to another one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to copy to. - * @return {PIXI.Rectangle} Returns given parameter. - */ - Rectangle.prototype.copyTo = function (rectangle) { - rectangle.x = this.x; - rectangle.y = this.y; - rectangle.width = this.width; - rectangle.height = this.height; - return rectangle; - }; - /** - * Checks whether the x and y coordinates given are contained within this Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rectangle - */ - Rectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x < this.x + this.width) { - if (y >= this.y && y < this.y + this.height) { - return true; - } - } - return false; - }; - /** - * Pads the rectangle making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.pad = function (paddingX, paddingY) { - if (paddingX === void 0) { paddingX = 0; } - if (paddingY === void 0) { paddingY = paddingX; } - this.x -= paddingX; - this.y -= paddingY; - this.width += paddingX * 2; - this.height += paddingY * 2; - return this; - }; - /** - * Fits this rectangle around the passed one. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to fit. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.fit = function (rectangle) { - var x1 = Math.max(this.x, rectangle.x); - var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.max(this.y, rectangle.y); - var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = Math.max(x2 - x1, 0); - this.y = y1; - this.height = Math.max(y2 - y1, 0); - return this; - }; - /** - * Enlarges rectangle that way its corners lie on grid - * - * @param {number} [resolution=1] resolution - * @param {number} [eps=0.001] precision - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.ceil = function (resolution, eps) { - if (resolution === void 0) { resolution = 1; } - if (eps === void 0) { eps = 0.001; } - var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution; - var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution; - this.x = Math.floor((this.x + eps) * resolution) / resolution; - this.y = Math.floor((this.y + eps) * resolution) / resolution; - this.width = x2 - this.x; - this.height = y2 - this.y; - return this; - }; - /** - * Enlarges this rectangle to include the passed rectangle. - * - * @param {PIXI.Rectangle} rectangle - The rectangle to include. - * @return {PIXI.Rectangle} Returns itself. - */ - Rectangle.prototype.enlarge = function (rectangle) { - var x1 = Math.min(this.x, rectangle.x); - var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width); - var y1 = Math.min(this.y, rectangle.y); - var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height); - this.x = x1; - this.width = x2 - x1; - this.y = y1; - this.height = y2 - y1; - return this; - }; - return Rectangle; - }()); - - /** - * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Circle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this circle - * @param {number} [y=0] - The Y coordinate of the center of this circle - * @param {number} [radius=0] - The radius of the circle - */ - function Circle(x, y, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (radius === void 0) { radius = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.CIRC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.CIRC; - } - /** - * Creates a clone of this Circle instance - * - * @return {PIXI.Circle} a copy of the Circle - */ - Circle.prototype.clone = function () { - return new Circle(this.x, this.y, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this circle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Circle - */ - Circle.prototype.contains = function (x, y) { - if (this.radius <= 0) { - return false; - } - var r2 = this.radius * this.radius; - var dx = (this.x - x); - var dy = (this.y - y); - dx *= dx; - dy *= dy; - return (dx + dy <= r2); - }; - /** - * Returns the framing rectangle of the circle as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Circle.prototype.getBounds = function () { - return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2); - }; - return Circle; - }()); - - /** - * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects. - * - * @class - * @memberof PIXI - */ - var Ellipse = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the center of this ellipse - * @param {number} [y=0] - The Y coordinate of the center of this ellipse - * @param {number} [halfWidth=0] - The half width of this ellipse - * @param {number} [halfHeight=0] - The half height of this ellipse - */ - function Ellipse(x, y, halfWidth, halfHeight) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (halfWidth === void 0) { halfWidth = 0; } - if (halfHeight === void 0) { halfHeight = 0; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = halfWidth; - /** - * @member {number} - * @default 0 - */ - this.height = halfHeight; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.ELIP - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.ELIP; - } - /** - * Creates a clone of this Ellipse instance - * - * @return {PIXI.Ellipse} a copy of the ellipse - */ - Ellipse.prototype.clone = function () { - return new Ellipse(this.x, this.y, this.width, this.height); - }; - /** - * Checks whether the x and y coordinates given are contained within this ellipse - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coords are within this ellipse - */ - Ellipse.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - // normalize the coords to an ellipse with center 0,0 - var normx = ((x - this.x) / this.width); - var normy = ((y - this.y) / this.height); - normx *= normx; - normy *= normy; - return (normx + normy <= 1); - }; - /** - * Returns the framing rectangle of the ellipse as a Rectangle object - * - * @return {PIXI.Rectangle} the framing rectangle - */ - Ellipse.prototype.getBounds = function () { - return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height); - }; - return Ellipse; - }()); - - /** - * A class to define a shape via user defined co-orinates. - * - * @class - * @memberof PIXI - */ - var Polygon = /** @class */ (function () { - /** - * @param {PIXI.Point[]|number[]|number[][]} points - This can be an array of Points - * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or - * the arguments passed can be all the points of the polygon e.g. - * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat - * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers. - */ - function Polygon() { - var arguments$1 = arguments; - - var points = []; - for (var _i = 0; _i < arguments.length; _i++) { - points[_i] = arguments$1[_i]; - } - if (Array.isArray(points[0])) { - points = points[0]; - } - // if this is an array of points, convert it to a flat array of numbers - if (points[0] instanceof Point) { - points = points; - var p = []; - for (var i = 0, il = points.length; i < il; i++) { - p.push(points[i].x, points[i].y); - } - points = p; - } - /** - * An array of the points of this polygon - * - * @member {number[]} - */ - this.points = points; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readOnly - * @default PIXI.SHAPES.POLY - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.POLY; - /** - * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. - * @member {boolean} - * @default true - */ - this.closeStroke = true; - } - /** - * Creates a clone of this polygon - * - * @return {PIXI.Polygon} a copy of the polygon - */ - Polygon.prototype.clone = function () { - var points = this.points.slice(); - var polygon = new Polygon(points); - polygon.closeStroke = this.closeStroke; - return polygon; - }; - /** - * Checks whether the x and y coordinates passed to this function are contained within this polygon - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this polygon - */ - Polygon.prototype.contains = function (x, y) { - var inside = false; - // use some raycasting to test hits - // https://github.com/substack/point-in-polygon/blob/master/index.js - var length = this.points.length / 2; - for (var i = 0, j = length - 1; i < length; j = i++) { - var xi = this.points[i * 2]; - var yi = this.points[(i * 2) + 1]; - var xj = this.points[j * 2]; - var yj = this.points[(j * 2) + 1]; - var intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi); - if (intersect) { - inside = !inside; - } - } - return inside; - }; - return Polygon; - }()); - - /** - * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its - * top-left corner point (x, y) and by its width and its height and its radius. - * - * @class - * @memberof PIXI - */ - var RoundedRectangle = /** @class */ (function () { - /** - * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle - * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle - * @param {number} [width=0] - The overall width of this rounded rectangle - * @param {number} [height=0] - The overall height of this rounded rectangle - * @param {number} [radius=20] - Controls the radius of the rounded corners - */ - function RoundedRectangle(x, y, width, height, radius) { - if (x === void 0) { x = 0; } - if (y === void 0) { y = 0; } - if (width === void 0) { width = 0; } - if (height === void 0) { height = 0; } - if (radius === void 0) { radius = 20; } - /** - * @member {number} - * @default 0 - */ - this.x = x; - /** - * @member {number} - * @default 0 - */ - this.y = y; - /** - * @member {number} - * @default 0 - */ - this.width = width; - /** - * @member {number} - * @default 0 - */ - this.height = height; - /** - * @member {number} - * @default 20 - */ - this.radius = radius; - /** - * The type of the object, mainly used to avoid `instanceof` checks - * - * @member {number} - * @readonly - * @default PIXI.SHAPES.RREC - * @see PIXI.SHAPES - */ - this.type = exports.SHAPES.RREC; - } - /** - * Creates a clone of this Rounded Rectangle - * - * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle - */ - RoundedRectangle.prototype.clone = function () { - return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius); - }; - /** - * Checks whether the x and y coordinates given are contained within this Rounded Rectangle - * - * @param {number} x - The X coordinate of the point to test - * @param {number} y - The Y coordinate of the point to test - * @return {boolean} Whether the x/y coordinates are within this Rounded Rectangle - */ - RoundedRectangle.prototype.contains = function (x, y) { - if (this.width <= 0 || this.height <= 0) { - return false; - } - if (x >= this.x && x <= this.x + this.width) { - if (y >= this.y && y <= this.y + this.height) { - if ((y >= this.y + this.radius && y <= this.y + this.height - this.radius) - || (x >= this.x + this.radius && x <= this.x + this.width - this.radius)) { - return true; - } - var dx = x - (this.x + this.radius); - var dy = y - (this.y + this.radius); - var radius2 = this.radius * this.radius; - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.width - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dy = y - (this.y + this.height - this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - dx = x - (this.x + this.radius); - if ((dx * dx) + (dy * dy) <= radius2) { - return true; - } - } - } - return false; - }; - return RoundedRectangle; - }()); - /*! - * @pixi/display - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/display - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/display is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -11089,448 +11101,410 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Bounds = function Bounds() - { - /** - * @member {number} - * @default 0 - */ - this.minX = Infinity; - - /** - * @member {number} - * @default 0 - */ - this.minY = Infinity; - - /** - * @member {number} - * @default 0 - */ - this.maxX = -Infinity; - - /** - * @member {number} - * @default 0 - */ - this.maxY = -Infinity; - - this.rect = null; - }; - - /** - * Checks if bounds are empty. - * - * @return {boolean} True if empty. - */ - Bounds.prototype.isEmpty = function isEmpty () - { - return this.minX > this.maxX || this.minY > this.maxY; - }; - - /** - * Clears the bounds and resets. - * - */ - Bounds.prototype.clear = function clear () - { - this.minX = Infinity; - this.minY = Infinity; - this.maxX = -Infinity; - this.maxY = -Infinity; - }; - - /** - * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle - * It is not guaranteed that it will return tempRect - * - * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty - * @returns {PIXI.Rectangle} A rectangle of the bounds - */ - Bounds.prototype.getRectangle = function getRectangle (rect) - { - if (this.minX > this.maxX || this.minY > this.maxY) - { - return Rectangle.EMPTY; + var Bounds = /** @class */ (function () { + function Bounds() { + /** + * @member {number} + * @default 0 + */ + this.minX = Infinity; + /** + * @member {number} + * @default 0 + */ + this.minY = Infinity; + /** + * @member {number} + * @default 0 + */ + this.maxX = -Infinity; + /** + * @member {number} + * @default 0 + */ + this.maxY = -Infinity; + this.rect = null; + /** + * It is updated to _boundsID of corresponding object to keep bounds in sync with content. + * Updated from outside, thus public modifier. + * + * @member {number} + * @public + */ + this.updateID = -1; } - - rect = rect || new Rectangle(0, 0, 1, 1); - - rect.x = this.minX; - rect.y = this.minY; - rect.width = this.maxX - this.minX; - rect.height = this.maxY - this.minY; - - return rect; - }; - - /** - * This function should be inlined when its possible. - * - * @param {PIXI.Point} point - The point to add. - */ - Bounds.prototype.addPoint = function addPoint (point) - { - this.minX = Math.min(this.minX, point.x); - this.maxX = Math.max(this.maxX, point.x); - this.minY = Math.min(this.minY, point.y); - this.maxY = Math.max(this.maxY, point.y); - }; - - /** - * Adds a quad, not transformed - * - * @param {Float32Array} vertices - The verts to add. - */ - Bounds.prototype.addQuad = function addQuad (vertices) - { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - - var x = vertices[0]; - var y = vertices[1]; - - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = vertices[2]; - y = vertices[3]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = vertices[4]; - y = vertices[5]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = vertices[6]; - y = vertices[7]; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - - /** - * Adds sprite frame, transformed. - * - * @param {PIXI.Transform} transform - transform to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrame = function addFrame (transform, x0, y0, x1, y1) - { - this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); - }; - - /** - * Adds sprite frame, multiplied by matrix - * - * @param {PIXI.Matrix} matrix - matrix to apply - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - */ - Bounds.prototype.addFrameMatrix = function addFrameMatrix (matrix, x0, y0, x1, y1) - { - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - - var x = (a * x0) + (c * y0) + tx; - var y = (b * x0) + (d * y0) + ty; - - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = (a * x1) + (c * y0) + tx; - y = (b * x1) + (d * y0) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = (a * x0) + (c * y1) + tx; - y = (b * x0) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - x = (a * x1) + (c * y1) + tx; - y = (b * x1) + (d * y1) + ty; - minX = x < minX ? x : minX; - minY = y < minY ? y : minY; - maxX = x > maxX ? x : maxX; - maxY = y > maxY ? y : maxY; - - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - - /** - * Adds screen vertices from array - * - * @param {Float32Array} vertexData - calculated vertices - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertexData = function addVertexData (vertexData, beginOffset, endOffset) - { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - - for (var i = beginOffset; i < endOffset; i += 2) - { - var x = vertexData[i]; - var y = vertexData[i + 1]; - + /** + * Checks if bounds are empty. + * + * @return {boolean} True if empty. + */ + Bounds.prototype.isEmpty = function () { + return this.minX > this.maxX || this.minY > this.maxY; + }; + /** + * Clears the bounds and resets. + * + */ + Bounds.prototype.clear = function () { + this.minX = Infinity; + this.minY = Infinity; + this.maxX = -Infinity; + this.maxY = -Infinity; + }; + /** + * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle + * It is not guaranteed that it will return tempRect + * + * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty + * @returns {PIXI.Rectangle} A rectangle of the bounds + */ + Bounds.prototype.getRectangle = function (rect) { + if (this.minX > this.maxX || this.minY > this.maxY) { + return Rectangle.EMPTY; + } + rect = rect || new Rectangle(0, 0, 1, 1); + rect.x = this.minX; + rect.y = this.minY; + rect.width = this.maxX - this.minX; + rect.height = this.maxY - this.minY; + return rect; + }; + /** + * This function should be inlined when its possible. + * + * @param {PIXI.IPointData} point - The point to add. + */ + Bounds.prototype.addPoint = function (point) { + this.minX = Math.min(this.minX, point.x); + this.maxX = Math.max(this.maxX, point.x); + this.minY = Math.min(this.minY, point.y); + this.maxY = Math.max(this.maxY, point.y); + }; + /** + * Adds a quad, not transformed + * + * @param {Float32Array} vertices - The verts to add. + */ + Bounds.prototype.addQuad = function (vertices) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + var x = vertices[0]; + var y = vertices[1]; minX = x < minX ? x : minX; minY = y < minY ? y : minY; maxX = x > maxX ? x : maxX; maxY = y > maxY ? y : maxY; - } - - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - - /** - * Add an array of mesh vertices - * - * @param {PIXI.Transform} transform - mesh transform - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - */ - Bounds.prototype.addVertices = function addVertices (transform, vertices, beginOffset, endOffset) - { - this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); - }; - - /** - * Add an array of mesh vertices - * - * @param {PIXI.Matrix} matrix - mesh matrix - * @param {Float32Array} vertices - mesh coordinates in array - * @param {number} beginOffset - begin offset - * @param {number} endOffset - end offset, excluded - * @param {number} [padX] - x padding - * @param {number} [padY] - y padding - */ - Bounds.prototype.addVerticesMatrix = function addVerticesMatrix (matrix, vertices, beginOffset, endOffset, padX, padY) - { - var a = matrix.a; - var b = matrix.b; - var c = matrix.c; - var d = matrix.d; - var tx = matrix.tx; - var ty = matrix.ty; - - padX = padX || 0; - padY = padY || 0; - - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - - for (var i = beginOffset; i < endOffset; i += 2) - { - var rawX = vertices[i]; - var rawY = vertices[i + 1]; - var x = (a * rawX) + (c * rawY) + tx; - var y = (d * rawY) + (b * rawX) + ty; - - minX = Math.min(minX, x - padX); - maxX = Math.max(maxX, x + padX); - minY = Math.min(minY, y - padY); - maxY = Math.max(maxY, y + padY); - } - - this.minX = minX; - this.minY = minY; - this.maxX = maxX; - this.maxY = maxY; - }; - - /** - * Adds other Bounds - * - * @param {PIXI.Bounds} bounds - TODO - */ - Bounds.prototype.addBounds = function addBounds (bounds) - { - var minX = this.minX; - var minY = this.minY; - var maxX = this.maxX; - var maxY = this.maxY; - - this.minX = bounds.minX < minX ? bounds.minX : minX; - this.minY = bounds.minY < minY ? bounds.minY : minY; - this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; - this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; - }; - - /** - * Adds other Bounds, masked with Bounds - * - * @param {PIXI.Bounds} bounds - TODO - * @param {PIXI.Bounds} mask - TODO - */ - Bounds.prototype.addBoundsMask = function addBoundsMask (bounds, mask) - { - var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; - var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; - var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; - var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; - - if (_minX <= _maxX && _minY <= _maxY) - { + x = vertices[2]; + y = vertices[3]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[4]; + y = vertices[5]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = vertices[6]; + y = vertices[7]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds sprite frame, transformed. + * + * @param {PIXI.Transform} transform - transform to apply + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + */ + Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) { + this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1); + }; + /** + * Adds sprite frame, multiplied by matrix + * + * @param {PIXI.Matrix} matrix - matrix to apply + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + */ + Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) { + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; var minX = this.minX; var minY = this.minY; var maxX = this.maxX; var maxY = this.maxY; - - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - - /** - * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty - * - * @param {PIXI.Bounds} bounds other bounds - * @param {PIXI.Matrix} matrix multiplicator - */ - Bounds.prototype.addBoundsMatrix = function addBoundsMatrix (bounds, matrix) - { - this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); - }; - - /** - * Adds other Bounds, masked with Rectangle - * - * @param {PIXI.Bounds} bounds - TODO - * @param {PIXI.Rectangle} area - TODO - */ - Bounds.prototype.addBoundsArea = function addBoundsArea (bounds, area) - { - var _minX = bounds.minX > area.x ? bounds.minX : area.x; - var _minY = bounds.minY > area.y ? bounds.minY : area.y; - var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); - var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); - - if (_minX <= _maxX && _minY <= _maxY) - { + var x = (a * x0) + (c * y0) + tx; + var y = (b * x0) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y0) + tx; + y = (b * x1) + (d * y0) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x0) + (c * y1) + tx; + y = (b * x0) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + x = (a * x1) + (c * y1) + tx; + y = (b * x1) + (d * y1) + ty; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds screen vertices from array + * + * @param {Float32Array} vertexData - calculated vertices + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + */ + Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) { var minX = this.minX; var minY = this.minY; var maxX = this.maxX; var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var x = vertexData[i]; + var y = vertexData[i + 1]; + minX = x < minX ? x : minX; + minY = y < minY ? y : minY; + maxX = x > maxX ? x : maxX; + maxY = y > maxY ? y : maxY; + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Add an array of mesh vertices + * + * @param {PIXI.Transform} transform - mesh transform + * @param {Float32Array} vertices - mesh coordinates in array + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + */ + Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) { + this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset); + }; + /** + * Add an array of mesh vertices. + * + * @param {PIXI.Matrix} matrix - mesh matrix + * @param {Float32Array} vertices - mesh coordinates in array + * @param {number} beginOffset - begin offset + * @param {number} endOffset - end offset, excluded + * @param {number} [padX=0] - x padding + * @param {number} [padY=0] - y padding + */ + Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) { + if (padX === void 0) { padX = 0; } + if (padY === void 0) { padY = padX; } + var a = matrix.a; + var b = matrix.b; + var c = matrix.c; + var d = matrix.d; + var tx = matrix.tx; + var ty = matrix.ty; + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + for (var i = beginOffset; i < endOffset; i += 2) { + var rawX = vertices[i]; + var rawY = vertices[i + 1]; + var x = (a * rawX) + (c * rawY) + tx; + var y = (d * rawY) + (b * rawX) + ty; + minX = Math.min(minX, x - padX); + maxX = Math.max(maxX, x + padX); + minY = Math.min(minY, y - padY); + maxY = Math.max(maxY, y + padY); + } + this.minX = minX; + this.minY = minY; + this.maxX = maxX; + this.maxY = maxY; + }; + /** + * Adds other Bounds. + * + * @param {PIXI.Bounds} bounds - The Bounds to be added + */ + Bounds.prototype.addBounds = function (bounds) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = bounds.minX < minX ? bounds.minX : minX; + this.minY = bounds.minY < minY ? bounds.minY : minY; + this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX; + this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY; + }; + /** + * Adds other Bounds, masked with Bounds. + * + * @param {PIXI.Bounds} bounds - The Bounds to be added. + * @param {PIXI.Bounds} mask - TODO + */ + Bounds.prototype.addBoundsMask = function (bounds, mask) { + var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX; + var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY; + var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX; + var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY; + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty. + * + * @param {PIXI.Bounds} bounds - other bounds + * @param {PIXI.Matrix} matrix - multiplicator + */ + Bounds.prototype.addBoundsMatrix = function (bounds, matrix) { + this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY); + }; + /** + * Adds other Bounds, masked with Rectangle. + * + * @param {PIXI.Bounds} bounds - TODO + * @param {PIXI.Rectangle} area - TODO + */ + Bounds.prototype.addBoundsArea = function (bounds, area) { + var _minX = bounds.minX > area.x ? bounds.minX : area.x; + var _minY = bounds.minY > area.y ? bounds.minY : area.y; + var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width); + var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height); + if (_minX <= _maxX && _minY <= _maxY) { + var minX = this.minX; + var minY = this.minY; + var maxX = this.maxX; + var maxY = this.maxY; + this.minX = _minX < minX ? _minX : minX; + this.minY = _minY < minY ? _minY : minY; + this.maxX = _maxX > maxX ? _maxX : maxX; + this.maxY = _maxY > maxY ? _maxY : maxY; + } + }; + /** + * Pads bounds object, making it grow in all directions. + * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. + * + * @param {number} [paddingX=0] - The horizontal padding amount. + * @param {number} [paddingY=0] - The vertical padding amount. + */ + Bounds.prototype.pad = function (paddingX, paddingY) { + if (paddingX === void 0) { paddingX = 0; } + if (paddingY === void 0) { paddingY = paddingX; } + if (!this.isEmpty()) { + this.minX -= paddingX; + this.maxX += paddingX; + this.minY -= paddingY; + this.maxY += paddingY; + } + }; + /** + * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) + * + * @param {number} x0 - left X of frame + * @param {number} y0 - top Y of frame + * @param {number} x1 - right X of frame + * @param {number} y1 - bottom Y of frame + * @param {number} padX - padding X + * @param {number} padY - padding Y + */ + Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) { + x0 -= padX; + y0 -= padY; + x1 += padX; + y1 += padY; + this.minX = this.minX < x0 ? this.minX : x0; + this.maxX = this.maxX > x1 ? this.maxX : x1; + this.minY = this.minY < y0 ? this.minY : y0; + this.maxY = this.maxY > y1 ? this.maxY : y1; + }; + return Bounds; + }()); - this.minX = _minX < minX ? _minX : minX; - this.minY = _minY < minY ? _minY : minY; - this.maxX = _maxX > maxX ? _maxX : maxX; - this.maxY = _maxY > maxY ? _maxY : maxY; - } - }; - - /** - * Pads bounds object, making it grow in all directions. - * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. - * - * @param {number} [paddingX=0] - The horizontal padding amount. - * @param {number} [paddingY=0] - The vertical padding amount. - */ - Bounds.prototype.pad = function pad (paddingX, paddingY) - { - paddingX = paddingX || 0; - paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0); - - if (!this.isEmpty()) - { - this.minX -= paddingX; - this.maxX += paddingX; - this.minY -= paddingY; - this.maxY += paddingY; - } - }; - - /** - * Adds padded frame. (x0, y0) should be strictly less than (x1, y1) - * - * @param {number} x0 - left X of frame - * @param {number} y0 - top Y of frame - * @param {number} x1 - right X of frame - * @param {number} y1 - bottom Y of frame - * @param {number} padX - padding X - * @param {number} padY - padding Y - */ - Bounds.prototype.addFramePad = function addFramePad (x0, y0, x1, y1, padX, padY) - { - x0 -= padX; - y0 -= padY; - x1 += padX; - y1 += padY; - - this.minX = this.minX < x0 ? this.minX : x0; - this.maxX = this.maxX > x1 ? this.maxX : x1; - this.minY = this.minY < y0 ? this.minY : y0; - this.maxY = this.maxY > y1 ? this.maxY : y1; - }; - - // _tempDisplayObjectParent = new DisplayObject(); + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } /** * The base class for all objects that are rendered on the screen. * - * This is an abstract class and should not be used on its own; rather it should be extended. + * This is an abstract class and should not be used on its own; rather it should b e extended. * * @class * @extends PIXI.utils.EventEmitter * @memberof PIXI */ - var DisplayObject = /*@__PURE__*/(function (EventEmitter) { - function DisplayObject() - { - EventEmitter.call(this); - - this.tempDisplayObjectParent = null; - + var DisplayObject = /** @class */ (function (_super) { + __extends(DisplayObject, _super); + function DisplayObject() { + var _this = _super.call(this) || this; + _this.tempDisplayObjectParent = null; // TODO: need to create Transform from factory /** * World transform and local transform of this object. @@ -11538,15 +11512,13 @@ var PIXI = (function (exports) { * * @member {PIXI.Transform} */ - this.transform = new Transform(); - + _this.transform = new Transform(); /** * The opacity of the object. * * @member {number} */ - this.alpha = 1; - + _this.alpha = 1; /** * The visibility of the object. If false the object will not be drawn, and * the updateTransform function will not be called. @@ -11555,8 +11527,7 @@ var PIXI = (function (exports) { * * @member {boolean} */ - this.visible = true; - + _this.visible = true; /** * Can this object be rendered, if false the object will not be drawn but the updateTransform * methods will still be called. @@ -11565,24 +11536,20 @@ var PIXI = (function (exports) { * * @member {boolean} */ - this.renderable = true; - + _this.renderable = true; /** * The display object container that contains this display object. * * @member {PIXI.Container} - * @readonly */ - this.parent = null; - + _this.parent = null; /** * The multiplied alpha of the displayObject. * * @member {number} * @readonly */ - this.worldAlpha = 1; - + _this.worldAlpha = 1; /** * Which index in the children array the display component was before the previous zIndex sort. * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider. @@ -11590,8 +11557,7 @@ var PIXI = (function (exports) { * @member {number} * @protected */ - this._lastSortedIndex = 0; - + _this._lastSortedIndex = 0; /** * The zIndex of the displayObject. * A higher value will mean it will be rendered on top of other displayObjects within the same container. @@ -11599,8 +11565,7 @@ var PIXI = (function (exports) { * @member {number} * @protected */ - this._zIndex = 0; - + _this._zIndex = 0; /** * The area the filter is applied to. This is used as more of an optimization * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle. @@ -11609,8 +11574,7 @@ var PIXI = (function (exports) { * * @member {?PIXI.Rectangle} */ - this.filterArea = null; - + _this.filterArea = null; /** * Sets the filters for the displayObject. * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. @@ -11618,147 +11582,125 @@ var PIXI = (function (exports) { * * @member {?PIXI.Filter[]} */ - this.filters = null; - this._enabledFilters = null; - + _this.filters = null; + /** + * Currently enabled filters + * @member {PIXI.Filter[]} + * @protected + */ + _this._enabledFilters = null; /** * The bounds object, this is used to calculate and store the bounds of the displayObject. * * @member {PIXI.Bounds} + */ + _this._bounds = new Bounds(); + /** + * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`. + * + * @member {PIXI.Bounds} + */ + _this._localBounds = null; + /** + * Flags the cached bounds as dirty. + * + * @member {number} * @protected */ - this._bounds = new Bounds(); - this._boundsID = 0; - this._lastBoundsID = -1; - this._boundsRect = null; - this._localBoundsRect = null; - + _this._boundsID = 0; + /** + * Cache of this display-object's bounds-rectangle. + * + * @member {PIXI.Bounds} + * @protected + */ + _this._boundsRect = null; + /** + * Cache of this display-object's local-bounds rectangle. + * + * @member {PIXI.Bounds} + * @protected + */ + _this._localBoundsRect = null; /** * The original, cached mask of the object. * - * @member {PIXI.Graphics|PIXI.Sprite|null} + * @member {PIXI.Container|PIXI.MaskData|null} * @protected */ - this._mask = null; - + _this._mask = null; /** * Fired when this DisplayObject is added to a Container. * * @event PIXI.DisplayObject#added * @param {PIXI.Container} container - The container added to. */ - /** * Fired when this DisplayObject is removed from a Container. * * @event PIXI.DisplayObject#removed * @param {PIXI.Container} container - The container removed from. */ - /** * If the object has been destroyed via destroy(). If true, it should not be used. * * @member {boolean} * @protected */ - this._destroyed = false; - + _this._destroyed = false; /** * used to fast check if a sprite is.. a sprite! * @member {boolean} */ - this.isSprite = false; - + _this.isSprite = false; /** * Does any other displayObject use this object as a mask? * @member {boolean} */ - this.isMask = false; + _this.isMask = false; + return _this; } - - if ( EventEmitter ) { DisplayObject.__proto__ = EventEmitter; } - DisplayObject.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - DisplayObject.prototype.constructor = DisplayObject; - - var prototypeAccessors = { _tempDisplayObjectParent: { configurable: true },x: { configurable: true },y: { configurable: true },worldTransform: { configurable: true },localTransform: { configurable: true },position: { configurable: true },scale: { configurable: true },pivot: { configurable: true },skew: { configurable: true },rotation: { configurable: true },angle: { configurable: true },zIndex: { configurable: true },worldVisible: { configurable: true },mask: { configurable: true } }; - /** - * @protected - * @member {PIXI.DisplayObject} + * Mixes all enumerable properties and methods from a source object to DisplayObject. + * + * @param {object} source - The source of properties and methods to mix in. */ - DisplayObject.mixin = function mixin (source) - { + DisplayObject.mixin = function (source) { // in ES8/ES2017, this would be really easy: - // Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - + // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source)); // get all the enumerable property keys var keys = Object.keys(source); - // loop through properties - for (var i = 0; i < keys.length; ++i) - { + for (var i = 0; i < keys.length; ++i) { var propertyName = keys[i]; - // Set the property using the property descriptor - this works for accessors and normal value properties - Object.defineProperty( - DisplayObject.prototype, - propertyName, - Object.getOwnPropertyDescriptor(source, propertyName) - ); + Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName)); } }; - - prototypeAccessors._tempDisplayObjectParent.get = function () - { - if (this.tempDisplayObjectParent === null) - { - this.tempDisplayObjectParent = new DisplayObject(); + /** + * Recursively updates transform of all objects from the root to this one + * internal function for toLocal() + */ + DisplayObject.prototype._recursivePostUpdateTransform = function () { + if (this.parent) { + this.parent._recursivePostUpdateTransform(); + this.transform.updateTransform(this.parent.transform); + } + else { + this.transform.updateTransform(this._tempDisplayObjectParent.transform); } - - return this.tempDisplayObjectParent; }; - /** * Updates the object transform for rendering. * * TODO - Optimization pass! */ - DisplayObject.prototype.updateTransform = function updateTransform () - { + DisplayObject.prototype.updateTransform = function () { this._boundsID++; - this.transform.updateTransform(this.parent.transform); // multiply the alphas.. this.worldAlpha = this.alpha * this.parent.worldAlpha; }; - - /** - * Recalculates the bounds of the display object. - * - * Does nothing by default and can be overwritten in a parent class. - */ - DisplayObject.prototype.calculateBounds = function calculateBounds () - { - // OVERWRITE; - }; - - /** - * Recursively updates transform of all objects from the root to this one - * internal function for toLocal() - */ - DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform () - { - if (this.parent) - { - this.parent._recursivePostUpdateTransform(); - this.transform.updateTransform(this.parent.transform); - } - else - { - this.transform.updateTransform(this._tempDisplayObjectParent.transform); - } - }; - /** * Retrieves the bounds of the displayObject as a rectangle object. * @@ -11768,178 +11710,132 @@ var PIXI = (function (exports) { * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. * @return {PIXI.Rectangle} The rectangular bounding area. */ - DisplayObject.prototype.getBounds = function getBounds (skipUpdate, rect) - { - if (!skipUpdate) - { - if (!this.parent) - { + DisplayObject.prototype.getBounds = function (skipUpdate, rect) { + if (!skipUpdate) { + if (!this.parent) { this.parent = this._tempDisplayObjectParent; this.updateTransform(); this.parent = null; } - else - { + else { this._recursivePostUpdateTransform(); this.updateTransform(); } } - - if (this._boundsID !== this._lastBoundsID) - { + if (this._bounds.updateID !== this._boundsID) { this.calculateBounds(); - this._lastBoundsID = this._boundsID; + this._bounds.updateID = this._boundsID; } - - if (!rect) - { - if (!this._boundsRect) - { + if (!rect) { + if (!this._boundsRect) { this._boundsRect = new Rectangle(); } - rect = this._boundsRect; } - return this._bounds.getRectangle(rect); }; - /** * Retrieves the local bounds of the displayObject as a rectangle object. * * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. * @return {PIXI.Rectangle} The rectangular bounding area. */ - DisplayObject.prototype.getLocalBounds = function getLocalBounds (rect) - { - var transformRef = this.transform; - var parentRef = this.parent; - - this.parent = null; - this.transform = this._tempDisplayObjectParent.transform; - - if (!rect) - { - if (!this._localBoundsRect) - { + DisplayObject.prototype.getLocalBounds = function (rect) { + if (!rect) { + if (!this._localBoundsRect) { this._localBoundsRect = new Rectangle(); } - rect = this._localBoundsRect; } - + if (!this._localBounds) { + this._localBounds = new Bounds(); + } + var transformRef = this.transform; + var parentRef = this.parent; + this.parent = null; + this.transform = this._tempDisplayObjectParent.transform; + var worldBounds = this._bounds; + var worldBoundsID = this._boundsID; + this._bounds = this._localBounds; var bounds = this.getBounds(false, rect); - this.parent = parentRef; this.transform = transformRef; - + this._bounds = worldBounds; + this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects return bounds; }; - /** * Calculates the global position of the display object. * - * @param {PIXI.IPoint} position - The world origin to calculate from. - * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional + * @param {PIXI.IPointData} position - The world origin to calculate from. + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform. - * @return {PIXI.IPoint} A point object representing the position of this object. + * @return {PIXI.Point} A point object representing the position of this object. */ - DisplayObject.prototype.toGlobal = function toGlobal (position, point, skipUpdate) - { - if ( skipUpdate === void 0 ) { skipUpdate = false; } - - if (!skipUpdate) - { + DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) { + if (skipUpdate === void 0) { skipUpdate = false; } + if (!skipUpdate) { this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) - { + if (!this.parent) { this.parent = this._tempDisplayObjectParent; this.displayObjectUpdateTransform(); this.parent = null; } - else - { + else { this.displayObjectUpdateTransform(); } } - // don't need to update the lot return this.worldTransform.apply(position, point); }; - /** * Calculates the local position of the display object relative to another point. * - * @param {PIXI.IPoint} position - The world origin to calculate from. + * @param {PIXI.IPointData} position - The world origin to calculate from. * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from. - * @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional * (otherwise will create a new Point). * @param {boolean} [skipUpdate=false] - Should we skip the update transform - * @return {PIXI.IPoint} A point object representing the position of this object + * @return {PIXI.Point} A point object representing the position of this object */ - DisplayObject.prototype.toLocal = function toLocal (position, from, point, skipUpdate) - { - if (from) - { + DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) { + if (from) { position = from.toGlobal(position, point, skipUpdate); } - - if (!skipUpdate) - { + if (!skipUpdate) { this._recursivePostUpdateTransform(); - // this parent check is for just in case the item is a root object. // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly // this is mainly to avoid a parent check in the main loop. Every little helps for performance :) - if (!this.parent) - { + if (!this.parent) { this.parent = this._tempDisplayObjectParent; this.displayObjectUpdateTransform(); this.parent = null; } - else - { + else { this.displayObjectUpdateTransform(); } } - // simply apply the matrix.. return this.worldTransform.applyInverse(position, point); }; - - /** - * Renders the object using the WebGL renderer. - * - * @param {PIXI.Renderer} renderer - The renderer. - */ - DisplayObject.prototype.render = function render (renderer) // eslint-disable-line no-unused-vars - { - // OVERWRITE; - }; - /** * Set the parent Container of this DisplayObject. * * @param {PIXI.Container} container - The Container to add this DisplayObject to. * @return {PIXI.Container} The Container that this DisplayObject was added to. */ - DisplayObject.prototype.setParent = function setParent (container) - { - if (!container || !container.addChild) - { + DisplayObject.prototype.setParent = function (container) { + if (!container || !container.addChild) { throw new Error('setParent: Argument must be a Container'); } - container.addChild(this); - return container; }; - /** * Convenience function to set the position, scale, skew and pivot at once. * @@ -11954,18 +11850,16 @@ var PIXI = (function (exports) { * @param {number} [pivotY=0] - The Y pivot value * @return {PIXI.DisplayObject} The DisplayObject instance */ - DisplayObject.prototype.setTransform = function setTransform (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) - { - if ( x === void 0 ) { x = 0; } - if ( y === void 0 ) { y = 0; } - if ( scaleX === void 0 ) { scaleX = 1; } - if ( scaleY === void 0 ) { scaleY = 1; } - if ( rotation === void 0 ) { rotation = 0; } - if ( skewX === void 0 ) { skewX = 0; } - if ( skewY === void 0 ) { skewY = 0; } - if ( pivotX === void 0 ) { pivotX = 0; } - if ( pivotY === void 0 ) { pivotY = 0; } - + DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (scaleX === void 0) { scaleX = 1; } + if (scaleY === void 0) { scaleY = 1; } + if (rotation === void 0) { rotation = 0; } + if (skewX === void 0) { skewX = 0; } + if (skewY === void 0) { skewY = 0; } + if (pivotX === void 0) { pivotX = 0; } + if (pivotY === void 0) { pivotY = 0; } this.position.x = x; this.position.y = y; this.scale.x = !scaleX ? 1 : scaleX; @@ -11975,10 +11869,8 @@ var PIXI = (function (exports) { this.skew.y = skewY; this.pivot.x = pivotX; this.pivot.y = pivotY; - return this; }; - /** * Base destroy method for generic display objects. This will automatically * remove the display object from its parent Container as well as remove @@ -11986,275 +11878,305 @@ var PIXI = (function (exports) { * after calling `destroy()`. * */ - DisplayObject.prototype.destroy = function destroy () - { - if (this.parent) - { + DisplayObject.prototype.destroy = function (_options) { + if (this.parent) { this.parent.removeChild(this); } this.removeAllListeners(); this.transform = null; - this.parent = null; this._bounds = null; - this._currentBounds = null; this._mask = null; - this.filters = null; this.filterArea = null; this.hitArea = null; - this.interactive = false; this.interactiveChildren = false; - this._destroyed = true; }; - - /** - * The position of the displayObject on the x axis relative to the local coordinates of the parent. - * An alias to position.x - * - * @member {number} - */ - prototypeAccessors.x.get = function () - { - return this.position.x; - }; - - prototypeAccessors.x.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.position.x = value; - }; - - /** - * The position of the displayObject on the y axis relative to the local coordinates of the parent. - * An alias to position.y - * - * @member {number} - */ - prototypeAccessors.y.get = function () - { - return this.position.y; - }; - - prototypeAccessors.y.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.position.y = value; - }; - - /** - * Current transform of the object based on world (parent) factors. - * - * @member {PIXI.Matrix} - * @readonly - */ - prototypeAccessors.worldTransform.get = function () - { - return this.transform.worldTransform; - }; - - /** - * Current transform of the object based on local factors: position, scale, other stuff. - * - * @member {PIXI.Matrix} - * @readonly - */ - prototypeAccessors.localTransform.get = function () - { - return this.transform.localTransform; - }; - - /** - * The coordinate of the object relative to the local coordinates of the parent. - * Assignment by value since pixi-v4. - * - * @member {PIXI.IPoint} - */ - prototypeAccessors.position.get = function () - { - return this.transform.position; - }; - - prototypeAccessors.position.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.position.copyFrom(value); - }; - - /** - * The scale factor of the object. - * Assignment by value since pixi-v4. - * - * @member {PIXI.IPoint} - */ - prototypeAccessors.scale.get = function () - { - return this.transform.scale; - }; - - prototypeAccessors.scale.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.scale.copyFrom(value); - }; - - /** - * The pivot point of the displayObject that it rotates around. - * Assignment by value since pixi-v4. - * - * @member {PIXI.IPoint} - */ - prototypeAccessors.pivot.get = function () - { - return this.transform.pivot; - }; - - prototypeAccessors.pivot.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.pivot.copyFrom(value); - }; - - /** - * The skew factor for the object in radians. - * Assignment by value since pixi-v4. - * - * @member {PIXI.ObservablePoint} - */ - prototypeAccessors.skew.get = function () - { - return this.transform.skew; - }; - - prototypeAccessors.skew.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.skew.copyFrom(value); - }; - - /** - * The rotation of the object in radians. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - prototypeAccessors.rotation.get = function () - { - return this.transform.rotation; - }; - - prototypeAccessors.rotation.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.rotation = value; - }; - - /** - * The angle of the object in degrees. - * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. - * - * @member {number} - */ - prototypeAccessors.angle.get = function () - { - return this.transform.rotation * RAD_TO_DEG; - }; - - prototypeAccessors.angle.set = function (value) // eslint-disable-line require-jsdoc - { - this.transform.rotation = value * DEG_TO_RAD; - }; - - /** - * The zIndex of the displayObject. - * If a container has the sortableChildren property set to true, children will be automatically - * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, - * and thus rendered on top of other displayObjects within the same container. - * - * @member {number} - */ - prototypeAccessors.zIndex.get = function () - { - return this._zIndex; - }; - - prototypeAccessors.zIndex.set = function (value) // eslint-disable-line require-jsdoc - { - this._zIndex = value; - if (this.parent) - { - this.parent.sortDirty = true; - } - }; - - /** - * Indicates if the object is globally visible. - * - * @member {boolean} - * @readonly - */ - prototypeAccessors.worldVisible.get = function () - { - var item = this; - - do - { - if (!item.visible) - { - return false; + Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", { + /** + * @protected + * @member {PIXI.Container} + */ + get: function () { + if (this.tempDisplayObjectParent === null) { + // eslint-disable-next-line no-use-before-define + this.tempDisplayObjectParent = new TemporaryDisplayObject(); } - - item = item.parent; - } while (item); - - return true; - }; - + return this.tempDisplayObjectParent; + }, + enumerable: false, + configurable: true + }); /** - * Sets a mask for the displayObject. A mask is an object that limits the visibility of an - * object to the shape of the mask applied to it. In PixiJS a regular mask must be a - * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it - * utilities shape clipping. To remove a mask, set this property to `null`. + * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root * - * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. - * @example - * const graphics = new PIXI.Graphics(); - * graphics.beginFill(0xFF3300); - * graphics.drawRect(50, 250, 100, 100); - * graphics.endFill(); + * ``` + * const cacheParent = elem.enableTempParent(); + * elem.updateTransform(); + * elem.disableTempParent(cacheParent); + * ``` * - * const sprite = new PIXI.Sprite(texture); - * sprite.mask = graphics; - * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. - * - * @member {PIXI.Container|PIXI.MaskData} + * @returns {PIXI.DisplayObject} current parent */ - prototypeAccessors.mask.get = function () - { - return this._mask; + DisplayObject.prototype.enableTempParent = function () { + var myParent = this.parent; + this.parent = this._tempDisplayObjectParent; + return myParent; }; - - prototypeAccessors.mask.set = function (value) // eslint-disable-line require-jsdoc - { - if (this._mask) - { - var maskObject = this._mask.maskObject || this._mask; - - maskObject.renderable = true; - maskObject.isMask = false; - } - - this._mask = value; - - if (this._mask) - { - var maskObject$1 = this._mask.maskObject || this._mask; - - maskObject$1.renderable = false; - maskObject$1.isMask = true; - } + /** + * Pair method for `enableTempParent` + * @param {PIXI.DisplayObject} cacheParent actual parent of element + */ + DisplayObject.prototype.disableTempParent = function (cacheParent) { + this.parent = cacheParent; }; - - Object.defineProperties( DisplayObject.prototype, prototypeAccessors ); - + Object.defineProperty(DisplayObject.prototype, "x", { + /** + * The position of the displayObject on the x axis relative to the local coordinates of the parent. + * An alias to position.x + * + * @member {number} + */ + get: function () { + return this.position.x; + }, + set: function (value) { + this.transform.position.x = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "y", { + /** + * The position of the displayObject on the y axis relative to the local coordinates of the parent. + * An alias to position.y + * + * @member {number} + */ + get: function () { + return this.position.y; + }, + set: function (value) { + this.transform.position.y = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldTransform", { + /** + * Current transform of the object based on world (parent) factors. + * + * @member {PIXI.Matrix} + * @readonly + */ + get: function () { + return this.transform.worldTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "localTransform", { + /** + * Current transform of the object based on local factors: position, scale, other stuff. + * + * @member {PIXI.Matrix} + * @readonly + */ + get: function () { + return this.transform.localTransform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "position", { + /** + * The coordinate of the object relative to the local coordinates of the parent. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.position; + }, + set: function (value) { + this.transform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "scale", { + /** + * The scale factor of the object. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.scale; + }, + set: function (value) { + this.transform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "pivot", { + /** + * The pivot point of the displayObject that it rotates around. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.pivot; + }, + set: function (value) { + this.transform.pivot.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "skew", { + /** + * The skew factor for the object in radians. + * Assignment by value since pixi-v4. + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.transform.skew; + }, + set: function (value) { + this.transform.skew.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "rotation", { + /** + * The rotation of the object in radians. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + * + * @member {number} + */ + get: function () { + return this.transform.rotation; + }, + set: function (value) { + this.transform.rotation = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "angle", { + /** + * The angle of the object in degrees. + * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees. + * + * @member {number} + */ + get: function () { + return this.transform.rotation * RAD_TO_DEG; + }, + set: function (value) { + this.transform.rotation = value * DEG_TO_RAD; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "zIndex", { + /** + * The zIndex of the displayObject. + * If a container has the sortableChildren property set to true, children will be automatically + * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, + * and thus rendered on top of other displayObjects within the same container. + * + * @member {number} + */ + get: function () { + return this._zIndex; + }, + set: function (value) { + this._zIndex = value; + if (this.parent) { + this.parent.sortDirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "worldVisible", { + /** + * Indicates if the object is globally visible. + * + * @member {boolean} + * @readonly + */ + get: function () { + var item = this; + do { + if (!item.visible) { + return false; + } + item = item.parent; + } while (item); + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DisplayObject.prototype, "mask", { + /** + * Sets a mask for the displayObject. A mask is an object that limits the visibility of an + * object to the shape of the mask applied to it. In PixiJS a regular mask must be a + * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it + * utilities shape clipping. To remove a mask, set this property to `null`. + * + * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask. + * @example + * const graphics = new PIXI.Graphics(); + * graphics.beginFill(0xFF3300); + * graphics.drawRect(50, 250, 100, 100); + * graphics.endFill(); + * + * const sprite = new PIXI.Sprite(texture); + * sprite.mask = graphics; + * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask. + * + * @member {PIXI.Container|PIXI.MaskData|null} + */ + get: function () { + return this._mask; + }, + set: function (value) { + if (this._mask) { + var maskObject = (this._mask.maskObject || this._mask); + maskObject.renderable = true; + maskObject.isMask = false; + } + this._mask = value; + if (this._mask) { + var maskObject = (this._mask.maskObject || this._mask); + maskObject.renderable = false; + maskObject.isMask = true; + } + }, + enumerable: false, + configurable: true + }); return DisplayObject; }(eventemitter3)); - + var TemporaryDisplayObject = /** @class */ (function (_super) { + __extends(TemporaryDisplayObject, _super); + function TemporaryDisplayObject() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.sortDirty = null; + return _this; + } + return TemporaryDisplayObject; + }(DisplayObject)); /** * DisplayObject default updateTransform, does not update children of container. * Will crash if there's no parent element. @@ -12264,16 +12186,12 @@ var PIXI = (function (exports) { */ DisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform; - function sortChildren(a, b) - { - if (a.zIndex === b.zIndex) - { + function sortChildren(a, b) { + if (a.zIndex === b.zIndex) { return a._lastSortedIndex - b._lastSortedIndex; } - return a.zIndex - b.zIndex; } - /** * A Container represents a collection of display objects. * @@ -12288,19 +12206,17 @@ var PIXI = (function (exports) { * @extends PIXI.DisplayObject * @memberof PIXI */ - var Container = /*@__PURE__*/(function (DisplayObject) { - function Container() - { - DisplayObject.call(this); - + var Container = /** @class */ (function (_super) { + __extends(Container, _super); + function Container() { + var _this = _super.call(this) || this; /** * The array of children of this container. * * @member {PIXI.DisplayObject[]} * @readonly */ - this.children = []; - + _this.children = []; /** * If set to true, the container will sort its children by zIndex value * when updateTransform() is called, or manually if sortChildren() is called. @@ -12316,16 +12232,15 @@ var PIXI = (function (exports) { * * @member {boolean} */ - this.sortableChildren = settings.SORTABLE_CHILDREN; - + _this.sortableChildren = settings.SORTABLE_CHILDREN; /** * Should children be sorted by zIndex at the next updateTransform call. * Will get automatically set to true if a new child is added, or if a child's zIndex changes. * * @member {boolean} */ - this.sortDirty = false; - + _this.sortDirty = false; + return _this; /** * Fired when a DisplayObject is added to this Container. * @@ -12334,7 +12249,6 @@ var PIXI = (function (exports) { * @param {PIXI.Container} container - The container that added the child. * @param {number} index - The children's index of the added child. */ - /** * Fired when a DisplayObject is removed from this Container. * @@ -12344,75 +12258,57 @@ var PIXI = (function (exports) { * @param {number} index - The former children's index of the removed child */ } - - if ( DisplayObject ) { Container.__proto__ = DisplayObject; } - Container.prototype = Object.create( DisplayObject && DisplayObject.prototype ); - Container.prototype.constructor = Container; - - var prototypeAccessors = { width: { configurable: true },height: { configurable: true } }; - /** * Overridable method that can be used by Container subclasses whenever the children array is modified * * @protected */ - Container.prototype.onChildrenChange = function onChildrenChange () - { + Container.prototype.onChildrenChange = function (_length) { /* empty */ }; - /** * Adds one or more children to the container. * * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)` * - * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container * @return {PIXI.DisplayObject} The first child that was added. */ - Container.prototype.addChild = function addChild (child) - { + Container.prototype.addChild = function () { var arguments$1 = arguments; - var argumentsLength = arguments.length; - + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } // if there is only one argument we can bypass looping through the them - if (argumentsLength > 1) - { - // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes - for (var i = 0; i < argumentsLength; i++) - { - this.addChild(arguments$1[i]); + if (children.length > 1) { + // loop through the array and add all children + for (var i = 0; i < children.length; i++) { + // eslint-disable-next-line prefer-rest-params + this.addChild(children[i]); } } - else - { + else { + var child = children[0]; // if the child has a parent then lets remove it as PixiJS objects can only exist in one place - if (child.parent) - { + if (child.parent) { child.parent.removeChild(child); } - child.parent = this; this.sortDirty = true; - // ensure child transform will be recalculated child.transform._parentID = -1; - this.children.push(child); - // ensure bounds will be recalculated this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(this.children.length - 1); this.emit('childAdded', child, this, this.children.length - 1); child.emit('added', this); } - - return child; + return children[0]; }; - /** * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown * @@ -12420,184 +12316,140 @@ var PIXI = (function (exports) { * @param {number} index - The index to place the child in * @return {PIXI.DisplayObject} The child that was added. */ - Container.prototype.addChildAt = function addChildAt (child, index) - { - if (index < 0 || index > this.children.length) - { - throw new Error((child + "addChildAt: The index " + index + " supplied is out of bounds " + (this.children.length))); + Container.prototype.addChildAt = function (child, index) { + if (index < 0 || index > this.children.length) { + throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length); } - - if (child.parent) - { + if (child.parent) { child.parent.removeChild(child); } - child.parent = this; this.sortDirty = true; - // ensure child transform will be recalculated child.transform._parentID = -1; - this.children.splice(index, 0, child); - // ensure bounds will be recalculated this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(index); child.emit('added', this); this.emit('childAdded', child, this, index); - return child; }; - /** * Swaps the position of 2 Display Objects within this container. * * @param {PIXI.DisplayObject} child - First display object to swap * @param {PIXI.DisplayObject} child2 - Second display object to swap */ - Container.prototype.swapChildren = function swapChildren (child, child2) - { - if (child === child2) - { + Container.prototype.swapChildren = function (child, child2) { + if (child === child2) { return; } - var index1 = this.getChildIndex(child); var index2 = this.getChildIndex(child2); - this.children[index1] = child2; this.children[index2] = child; this.onChildrenChange(index1 < index2 ? index1 : index2); }; - /** * Returns the index position of a child DisplayObject instance * * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify * @return {number} The index position of the child display object to identify */ - Container.prototype.getChildIndex = function getChildIndex (child) - { + Container.prototype.getChildIndex = function (child) { var index = this.children.indexOf(child); - - if (index === -1) - { + if (index === -1) { throw new Error('The supplied DisplayObject must be a child of the caller'); } - return index; }; - /** * Changes the position of an existing child in the display object container * * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number * @param {number} index - The resulting index number for the child display object */ - Container.prototype.setChildIndex = function setChildIndex (child, index) - { - if (index < 0 || index >= this.children.length) - { - throw new Error(("The index " + index + " supplied is out of bounds " + (this.children.length))); + Container.prototype.setChildIndex = function (child, index) { + if (index < 0 || index >= this.children.length) { + throw new Error("The index " + index + " supplied is out of bounds " + this.children.length); } - var currentIndex = this.getChildIndex(child); - removeItems(this.children, currentIndex, 1); // remove from old position this.children.splice(index, 0, child); // add at new position - this.onChildrenChange(index); }; - /** * Returns the child at the specified index * * @param {number} index - The index to get the child at * @return {PIXI.DisplayObject} The child at the given index, if any. */ - Container.prototype.getChildAt = function getChildAt (index) - { - if (index < 0 || index >= this.children.length) - { - throw new Error(("getChildAt: Index (" + index + ") does not exist.")); + Container.prototype.getChildAt = function (index) { + if (index < 0 || index >= this.children.length) { + throw new Error("getChildAt: Index (" + index + ") does not exist."); } - return this.children[index]; }; - /** * Removes one or more children from the container. * - * @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove + * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove * @return {PIXI.DisplayObject} The first child that was removed. */ - Container.prototype.removeChild = function removeChild (child) - { + Container.prototype.removeChild = function () { var arguments$1 = arguments; - var argumentsLength = arguments.length; - + var children = []; + for (var _i = 0; _i < arguments.length; _i++) { + children[_i] = arguments$1[_i]; + } // if there is only one argument we can bypass looping through the them - if (argumentsLength > 1) - { - // loop through the arguments property and add all children - // use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes - for (var i = 0; i < argumentsLength; i++) - { - this.removeChild(arguments$1[i]); + if (children.length > 1) { + // loop through the arguments property and remove all children + for (var i = 0; i < children.length; i++) { + this.removeChild(children[i]); } } - else - { + else { + var child = children[0]; var index = this.children.indexOf(child); - - if (index === -1) { return null; } - + if (index === -1) + { return null; } child.parent = null; // ensure child transform will be recalculated child.transform._parentID = -1; removeItems(this.children, index, 1); - // ensure bounds will be recalculated this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(index); child.emit('removed', this); this.emit('childRemoved', child, this, index); } - - return child; + return children[0]; }; - /** * Removes a child from the specified index position. * * @param {number} index - The index to get the child from * @return {PIXI.DisplayObject} The child that was removed. */ - Container.prototype.removeChildAt = function removeChildAt (index) - { + Container.prototype.removeChildAt = function (index) { var child = this.getChildAt(index); - // ensure child transform will be recalculated.. child.parent = null; child.transform._parentID = -1; removeItems(this.children, index, 1); - // ensure bounds will be recalculated this._boundsID++; - // TODO - lets either do all callbacks or all events.. not both! this.onChildrenChange(index); child.emit('removed', this); this.emit('childRemoved', child, this, index); - return child; }; - /** * Removes all children from this container that are within the begin and end indexes. * @@ -12605,261 +12457,200 @@ var PIXI = (function (exports) { * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container. * @returns {PIXI.DisplayObject[]} List of removed children */ - Container.prototype.removeChildren = function removeChildren (beginIndex, endIndex) - { - if ( beginIndex === void 0 ) { beginIndex = 0; } - + Container.prototype.removeChildren = function (beginIndex, endIndex) { + if (beginIndex === void 0) { beginIndex = 0; } + if (endIndex === void 0) { endIndex = this.children.length; } var begin = beginIndex; - var end = typeof endIndex === 'number' ? endIndex : this.children.length; + var end = endIndex; var range = end - begin; var removed; - - if (range > 0 && range <= end) - { + if (range > 0 && range <= end) { removed = this.children.splice(begin, range); - - for (var i = 0; i < removed.length; ++i) - { + for (var i = 0; i < removed.length; ++i) { removed[i].parent = null; - if (removed[i].transform) - { + if (removed[i].transform) { removed[i].transform._parentID = -1; } } - this._boundsID++; - this.onChildrenChange(beginIndex); - - for (var i$1 = 0; i$1 < removed.length; ++i$1) - { - removed[i$1].emit('removed', this); - this.emit('childRemoved', removed[i$1], this, i$1); + for (var i = 0; i < removed.length; ++i) { + removed[i].emit('removed', this); + this.emit('childRemoved', removed[i], this, i); } - return removed; } - else if (range === 0 && this.children.length === 0) - { + else if (range === 0 && this.children.length === 0) { return []; } - throw new RangeError('removeChildren: numeric values are outside the acceptable range.'); }; - /** * Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex. */ - Container.prototype.sortChildren = function sortChildren$1 () - { + Container.prototype.sortChildren = function () { var sortRequired = false; - - for (var i = 0, j = this.children.length; i < j; ++i) - { + for (var i = 0, j = this.children.length; i < j; ++i) { var child = this.children[i]; - child._lastSortedIndex = i; - - if (!sortRequired && child.zIndex !== 0) - { + if (!sortRequired && child.zIndex !== 0) { sortRequired = true; } } - - if (sortRequired && this.children.length > 1) - { + if (sortRequired && this.children.length > 1) { this.children.sort(sortChildren); } - this.sortDirty = false; }; - /** * Updates the transform on all children of this container for rendering */ - Container.prototype.updateTransform = function updateTransform () - { - if (this.sortableChildren && this.sortDirty) - { + Container.prototype.updateTransform = function () { + if (this.sortableChildren && this.sortDirty) { this.sortChildren(); } - this._boundsID++; - this.transform.updateTransform(this.parent.transform); - // TODO: check render flags, how to process stuff here this.worldAlpha = this.alpha * this.parent.worldAlpha; - - for (var i = 0, j = this.children.length; i < j; ++i) - { + for (var i = 0, j = this.children.length; i < j; ++i) { var child = this.children[i]; - - if (child.visible) - { + if (child.visible) { child.updateTransform(); } } }; - /** * Recalculates the bounds of the container. * */ - Container.prototype.calculateBounds = function calculateBounds () - { + Container.prototype.calculateBounds = function () { this._bounds.clear(); - this._calculateBounds(); - - for (var i = 0; i < this.children.length; i++) - { + for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; - - if (!child.visible || !child.renderable) - { + if (!child.visible || !child.renderable) { continue; } - child.calculateBounds(); - // TODO: filter+mask, need to mask both somehow - if (child._mask) - { - var maskObject = child._mask.maskObject || child._mask; - + if (child._mask) { + var maskObject = (child._mask.maskObject || child._mask); maskObject.calculateBounds(); this._bounds.addBoundsMask(child._bounds, maskObject._bounds); } - else if (child.filterArea) - { + else if (child.filterArea) { this._bounds.addBoundsArea(child._bounds, child.filterArea); } - else - { + else { this._bounds.addBounds(child._bounds); } } - - this._lastBoundsID = this._boundsID; + this._bounds.updateID = this._boundsID; + }; + /** + * Retrieves the local bounds of the displayObject as a rectangle object. + * + * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation. + * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms, + * it was default behaviour of pixi 4.0-5.2 and caused many problems to users. + * @return {PIXI.Rectangle} The rectangular bounding area. + */ + Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) { + if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; } + var result = _super.prototype.getLocalBounds.call(this, rect); + if (!skipChildrenUpdate) { + for (var i = 0, j = this.children.length; i < j; ++i) { + var child = this.children[i]; + if (child.visible) { + child.updateTransform(); + } + } + } + return result; }; - /** * Recalculates the bounds of the object. Override this to * calculate the bounds of the specific object (not including children). * * @protected */ - Container.prototype._calculateBounds = function _calculateBounds () - { + Container.prototype._calculateBounds = function () { // FILL IN// }; - /** * Renders the object using the WebGL renderer * * @param {PIXI.Renderer} renderer - The renderer */ - Container.prototype.render = function render (renderer) - { + Container.prototype.render = function (renderer) { // if the object is not visible or the alpha is 0 then no need to render this element - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) - { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { return; } - // do a quick check to see if this element has a mask or a filter. - if (this._mask || (this.filters && this.filters.length)) - { + if (this._mask || (this.filters && this.filters.length)) { this.renderAdvanced(renderer); } - else - { + else { this._render(renderer); - // simple render children! - for (var i = 0, j = this.children.length; i < j; ++i) - { + for (var i = 0, j = this.children.length; i < j; ++i) { this.children[i].render(renderer); } } }; - /** * Render the object using the WebGL renderer and advanced features. * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Container.prototype.renderAdvanced = function renderAdvanced (renderer) - { + Container.prototype.renderAdvanced = function (renderer) { renderer.batch.flush(); - var filters = this.filters; var mask = this._mask; - // push filter first as we need to ensure the stencil buffer is correct for any masking - if (filters) - { - if (!this._enabledFilters) - { + if (filters) { + if (!this._enabledFilters) { this._enabledFilters = []; } - this._enabledFilters.length = 0; - - for (var i = 0; i < filters.length; i++) - { - if (filters[i].enabled) - { + for (var i = 0; i < filters.length; i++) { + if (filters[i].enabled) { this._enabledFilters.push(filters[i]); } } - - if (this._enabledFilters.length) - { + if (this._enabledFilters.length) { renderer.filter.push(this, this._enabledFilters); } } - - if (mask) - { + if (mask) { renderer.mask.push(this, this._mask); } - // add this object to the batch, only rendered if it has a texture. this._render(renderer); - // now loop through the children and make sure they get rendered - for (var i$1 = 0, j = this.children.length; i$1 < j; i$1++) - { - this.children[i$1].render(renderer); + for (var i = 0, j = this.children.length; i < j; i++) { + this.children[i].render(renderer); } - renderer.batch.flush(); - - if (mask) - { - renderer.mask.pop(this, this._mask); + if (mask) { + renderer.mask.pop(this); } - - if (filters && this._enabledFilters && this._enabledFilters.length) - { + if (filters && this._enabledFilters && this._enabledFilters.length) { renderer.filter.pop(); } }; - /** * To be overridden by the subclasses. * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Container.prototype._render = function _render (renderer) // eslint-disable-line no-unused-vars - { + Container.prototype._render = function (_renderer) { // this is where content itself gets rendered... }; - /** * Removes all internal references and listeners as well as removes children from the display list. * Do not use a Container after calling `destroy`. @@ -12873,88 +12664,75 @@ var PIXI = (function (exports) { * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true * Should it destroy the base texture of the child sprite */ - Container.prototype.destroy = function destroy (options) - { - DisplayObject.prototype.destroy.call(this); - + Container.prototype.destroy = function (options) { + _super.prototype.destroy.call(this); this.sortDirty = false; - var destroyChildren = typeof options === 'boolean' ? options : options && options.children; - var oldChildren = this.removeChildren(0, this.children.length); - - if (destroyChildren) - { - for (var i = 0; i < oldChildren.length; ++i) - { + if (destroyChildren) { + for (var i = 0; i < oldChildren.length; ++i) { oldChildren[i].destroy(options); } } }; - - /** - * The width of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return this.scale.x * this.getLocalBounds().width; - }; - - prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc - { - var width = this.getLocalBounds().width; - - if (width !== 0) - { - this.scale.x = value / width; - } - else - { - this.scale.x = 1; - } - - this._width = value; - }; - - /** - * The height of the Container, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return this.scale.y * this.getLocalBounds().height; - }; - - prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc - { - var height = this.getLocalBounds().height; - - if (height !== 0) - { - this.scale.y = value / height; - } - else - { - this.scale.y = 1; - } - - this._height = value; - }; - - Object.defineProperties( Container.prototype, prototypeAccessors ); - + Object.defineProperty(Container.prototype, "width", { + /** + * The width of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this.scale.x * this.getLocalBounds().width; + }, + set: function (value) { + var width = this.getLocalBounds().width; + if (width !== 0) { + this.scale.x = value / width; + } + else { + this.scale.x = 1; + } + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Container.prototype, "height", { + /** + * The height of the Container, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this.scale.y * this.getLocalBounds().height; + }, + set: function (value) { + var height = this.getLocalBounds().height; + if (height !== 0) { + this.scale.y = value / height; + } + else { + this.scale.y = 1; + } + this._height = value; + }, + enumerable: false, + configurable: true + }); return Container; }(DisplayObject)); - - // performance increase to avoid using call.. (10x faster) + /** + * Container default updateTransform, does update children of container. + * Will crash if there's no parent element. + * + * @memberof PIXI.Container# + * @function containerUpdateTransform + */ Container.prototype.containerUpdateTransform = Container.prototype.updateTransform; /*! - * @pixi/accessibility - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/accessibility - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/accessibility is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -12962,18 +12740,18 @@ var PIXI = (function (exports) { /** * Default property values of accessible objects - * used by {@link PIXI.accessibility.AccessibilityManager}. + * used by {@link PIXI.AccessibilityManager}. * * @private * @function accessibleTarget - * @memberof PIXI.accessibility + * @memberof PIXI * @type {Object} * @example * function MyObject() {} * * Object.assign( * MyObject.prototype, - * PIXI.accessibility.accessibleTarget + * PIXI.accessibleTarget * ); */ var accessibleTarget = { @@ -12985,7 +12763,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ accessible: false, - /** * Sets the title attribute of the shadow div * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]' @@ -12994,7 +12771,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ accessibleTitle: null, - /** * Sets the aria-label attribute of the shadow div * @@ -13002,7 +12778,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ accessibleHint: null, - /** * @member {number} * @memberof PIXI.DisplayObject# @@ -13010,21 +12785,18 @@ var PIXI = (function (exports) { * @todo Needs docs. */ tabIndex: 0, - /** * @member {boolean} * @memberof PIXI.DisplayObject# * @todo Needs docs. */ _accessibleActive: false, - /** * @member {boolean} * @memberof PIXI.DisplayObject# * @todo Needs docs. */ - _accessibleDiv: false, - + _accessibleDiv: null, /** * Specify the type of div the accessible layer is. Screen readers treat the element differently * depending on this type. Defaults to button. @@ -13034,7 +12806,6 @@ var PIXI = (function (exports) { * @default 'button' */ accessibleType: 'button', - /** * Specify the pointer-events the accessible div will use * Defaults to auto. @@ -13044,7 +12815,6 @@ var PIXI = (function (exports) { * @default 'auto' */ accessiblePointerEvents: 'auto', - /** * Setting to false will prevent any children inside this container to * be accessible. Defaults to true. @@ -13054,23 +12824,20 @@ var PIXI = (function (exports) { * @default true */ accessibleChildren: true, + renderId: -1, }; // add some extra variables to the container.. DisplayObject.mixin(accessibleTarget); - var KEY_CODE_TAB = 9; - var DIV_TOUCH_SIZE = 100; var DIV_TOUCH_POS_X = 0; var DIV_TOUCH_POS_Y = 0; var DIV_TOUCH_ZINDEX = 2; - var DIV_HOOK_SIZE = 1; var DIV_HOOK_POS_X = -1000; var DIV_HOOK_POS_Y = -1000; var DIV_HOOK_ZINDEX = 2; - /** * The Accessibility manager recreates the ability to tab and have content read by screen readers. * This is very important as it can possibly help people with disabilities access PixiJS content. @@ -13081,571 +12848,475 @@ var PIXI = (function (exports) { * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility` * * @class - * @memberof PIXI.accessibility + * @memberof PIXI */ - var AccessibilityManager = function AccessibilityManager(renderer) - { + var AccessibilityManager = /** @class */ (function () { /** - * @type {?HTMLElement} - * @private + * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer */ - this._hookDiv = null; - if (isMobile$1.tablet || isMobile$1.phone) - { - this.createTouchHook(); - } - - // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. - var div = document.createElement('div'); - - div.style.width = DIV_TOUCH_SIZE + "px"; - div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.position = 'absolute'; - div.style.top = DIV_TOUCH_POS_X + "px"; - div.style.left = DIV_TOUCH_POS_Y + "px"; - div.style.zIndex = DIV_TOUCH_ZINDEX; - - /** - * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. - * - * @type {HTMLElement} - * @private - */ - this.div = div; - - /** - * A simple pool for storing divs. - * - * @type {*} - * @private - */ - this.pool = []; - - /** - * This is a tick used to check if an object is no longer being rendered. - * - * @type {Number} - * @private - */ - this.renderId = 0; - - /** - * Setting this to true will visually show the divs. - * - * @type {boolean} - */ - this.debug = false; - - /** - * The renderer this accessibility manager works for. - * - * @member {PIXI.AbstractRenderer} - */ - this.renderer = renderer; - - /** - * The array of currently active accessible items. - * - * @member {Array<*>} - * @private - */ - this.children = []; - - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onKeyDown = this._onKeyDown.bind(this); - - /** - * pre-bind the functions - * - * @type {Function} - * @private - */ - this._onMouseMove = this._onMouseMove.bind(this); - - /** - * A flag - * @type {boolean} - * @readonly - */ - this.isActive = false; - - /** - * A flag - * @type {boolean} - * @readonly - */ - this.isMobileAccessibility = false; - - // let listen for tab.. once pressed we can fire up and show the accessibility layer - window.addEventListener('keydown', this._onKeyDown, false); - }; - - /** - * Creates the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.createTouchHook = function createTouchHook () - { - var this$1 = this; - - var hookDiv = document.createElement('button'); - - hookDiv.style.width = DIV_HOOK_SIZE + "px"; - hookDiv.style.height = DIV_HOOK_SIZE + "px"; - hookDiv.style.position = 'absolute'; - hookDiv.style.top = DIV_HOOK_POS_X + "px"; - hookDiv.style.left = DIV_HOOK_POS_Y + "px"; - hookDiv.style.zIndex = DIV_HOOK_ZINDEX; - hookDiv.style.backgroundColor = '#FF0000'; - hookDiv.title = 'HOOK DIV'; - - hookDiv.addEventListener('focus', function () { - this$1.isMobileAccessibility = true; - this$1.activate(); - this$1.destroyTouchHook(); - }); - - document.body.appendChild(hookDiv); - this._hookDiv = hookDiv; - }; - - /** - * Destroys the touch hooks. - * - * @private - */ - AccessibilityManager.prototype.destroyTouchHook = function destroyTouchHook () - { - if (!this._hookDiv) - { - return; - } - document.body.removeChild(this._hookDiv); - this._hookDiv = null; - }; - - /** - * Activating will cause the Accessibility layer to be shown. - * This is called when a user presses the tab key. - * - * @private - */ - AccessibilityManager.prototype.activate = function activate () - { - if (this.isActive) - { - return; - } - - this.isActive = true; - - window.document.addEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown, false); - - this.renderer.on('postrender', this.update, this); - - if (this.renderer.view.parentNode) - { - this.renderer.view.parentNode.appendChild(this.div); - } - }; - - /** - * Deactivating will cause the Accessibility layer to be hidden. - * This is called when a user moves the mouse. - * - * @private - */ - AccessibilityManager.prototype.deactivate = function deactivate () - { - if (!this.isActive || this.isMobileAccessibility) - { - return; - } - - this.isActive = false; - - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.addEventListener('keydown', this._onKeyDown, false); - - this.renderer.off('postrender', this.update); - - if (this.div.parentNode) - { - this.div.parentNode.removeChild(this.div); - } - }; - - /** - * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. - * - * @private - * @param {PIXI.Container} displayObject - The DisplayObject to check. - */ - AccessibilityManager.prototype.updateAccessibleObjects = function updateAccessibleObjects (displayObject) - { - if (!displayObject.visible || !displayObject.accessibleChildren) - { - return; - } - - if (displayObject.accessible && displayObject.interactive) - { - if (!displayObject._accessibleActive) - { - this.addChild(displayObject); + function AccessibilityManager(renderer) { + /** + * @type {?HTMLElement} + * @private + */ + this._hookDiv = null; + if (isMobile$1.tablet || isMobile$1.phone) { + this.createTouchHook(); } - - displayObject.renderId = this.renderId; - } - - var children = displayObject.children; - - for (var i = 0; i < children.length; i++) - { - this.updateAccessibleObjects(children[i]); - } - }; - - /** - * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. - * - * @private - */ - AccessibilityManager.prototype.update = function update () - { - if (!this.renderer.renderingToScreen) - { - return; - } - - // update children... - this.updateAccessibleObjects(this.renderer._lastObjectRendered); - - var rect = this.renderer.view.getBoundingClientRect(); - var sx = rect.width / this.renderer.width; - var sy = rect.height / this.renderer.height; - - var div = this.div; - - div.style.left = (rect.left) + "px"; - div.style.top = (rect.top) + "px"; - div.style.width = (this.renderer.width) + "px"; - div.style.height = (this.renderer.height) + "px"; - - for (var i = 0; i < this.children.length; i++) - { - var child = this.children[i]; - - if (child.renderId !== this.renderId) - { - child._accessibleActive = false; - - removeItems(this.children, i, 1); - this.div.removeChild(child._accessibleDiv); - this.pool.push(child._accessibleDiv); - child._accessibleDiv = null; - - i--; - - if (this.children.length === 0) - { - this.deactivate(); - } - } - else - { - // map div to display.. - div = child._accessibleDiv; - var hitArea = child.hitArea; - var wt = child.worldTransform; - - if (child.hitArea) - { - div.style.left = ((wt.tx + (hitArea.x * wt.a)) * sx) + "px"; - div.style.top = ((wt.ty + (hitArea.y * wt.d)) * sy) + "px"; - - div.style.width = (hitArea.width * wt.a * sx) + "px"; - div.style.height = (hitArea.height * wt.d * sy) + "px"; - } - else - { - hitArea = child.getBounds(); - - this.capHitArea(hitArea); - - div.style.left = (hitArea.x * sx) + "px"; - div.style.top = (hitArea.y * sy) + "px"; - - div.style.width = (hitArea.width * sx) + "px"; - div.style.height = (hitArea.height * sy) + "px"; - - // update button titles and hints if they exist and they've changed - if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) - { - div.title = child.accessibleTitle; - } - if (div.getAttribute('aria-label') !== child.accessibleHint - && child.accessibleHint !== null) - { - div.setAttribute('aria-label', child.accessibleHint); - } - } - - // the title or index may have changed, if so lets update it! - if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) - { - div.title = child.accessibleTitle; - div.tabIndex = child.tabIndex; - if (this.debug) { this.updateDebugHTML(div); } - } - } - } - - // increment the render id.. - this.renderId++; - }; - - /** - * private function that will visually add the information to the - * accessability div - * - * @param {HTMLDivElement} div - */ - AccessibilityManager.prototype.updateDebugHTML = function updateDebugHTML (div) - { - div.innerHTML = "type: " + (div.type) + "
title : " + (div.title) + "
tabIndex: " + (div.tabIndex); - }; - - /** - * Adjust the hit area based on the bounds of a display object - * - * @param {PIXI.Rectangle} hitArea - Bounds of the child - */ - AccessibilityManager.prototype.capHitArea = function capHitArea (hitArea) - { - if (hitArea.x < 0) - { - hitArea.width += hitArea.x; - hitArea.x = 0; - } - - if (hitArea.y < 0) - { - hitArea.height += hitArea.y; - hitArea.y = 0; - } - - if (hitArea.x + hitArea.width > this.renderer.width) - { - hitArea.width = this.renderer.width - hitArea.x; - } - - if (hitArea.y + hitArea.height > this.renderer.height) - { - hitArea.height = this.renderer.height - hitArea.y; - } - }; - - /** - * Adds a DisplayObject to the accessibility manager - * - * @private - * @param {PIXI.DisplayObject} displayObject - The child to make accessible. - */ - AccessibilityManager.prototype.addChild = function addChild (displayObject) - { - //this.activate(); - - var div = this.pool.pop(); - - if (!div) - { - div = document.createElement('button'); - + // first we create a div that will sit over the PixiJS element. This is where the div overlays will go. + var div = document.createElement('div'); div.style.width = DIV_TOUCH_SIZE + "px"; div.style.height = DIV_TOUCH_SIZE + "px"; - div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent'; div.style.position = 'absolute'; - div.style.zIndex = DIV_TOUCH_ZINDEX; - div.style.borderStyle = 'none'; - - // ARIA attributes ensure that button title and hint updates are announced properly - if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) - { - // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. - div.setAttribute('aria-live', 'off'); + div.style.top = DIV_TOUCH_POS_X + "px"; + div.style.left = DIV_TOUCH_POS_Y + "px"; + div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); + /** + * This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. + * + * @type {HTMLElement} + * @private + */ + this.div = div; + /** + * A simple pool for storing divs. + * + * @type {*} + * @private + */ + this.pool = []; + /** + * This is a tick used to check if an object is no longer being rendered. + * + * @type {Number} + * @private + */ + this.renderId = 0; + /** + * Setting this to true will visually show the divs. + * + * @type {boolean} + */ + this.debug = false; + /** + * The renderer this accessibility manager works for. + * + * @member {PIXI.AbstractRenderer} + */ + this.renderer = renderer; + /** + * The array of currently active accessible items. + * + * @member {Array<*>} + * @private + */ + this.children = []; + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ + this._onKeyDown = this._onKeyDown.bind(this); + /** + * pre-bind the functions + * + * @type {Function} + * @private + */ + this._onMouseMove = this._onMouseMove.bind(this); + this._isActive = false; + this._isMobileAccessibility = false; + /** + * count to throttle div updates on android devices + * @type number + * @private + */ + this.androidUpdateCount = 0; + /** + * the frequency to update the div elements () + * @private + */ + this.androidUpdateFrequency = 500; // 2fps + // let listen for tab.. once pressed we can fire up and show the accessibility layer + window.addEventListener('keydown', this._onKeyDown, false); + } + Object.defineProperty(AccessibilityManager.prototype, "isActive", { + /** + * A flag + * @member {boolean} + * @readonly + */ + get: function () { + return this._isActive; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AccessibilityManager.prototype, "isMobileAccessibility", { + /** + * A flag + * @member {boolean} + * @readonly + */ + get: function () { + return this._isMobileAccessibility; + }, + enumerable: false, + configurable: true + }); + /** + * Creates the touch hooks. + * + * @private + */ + AccessibilityManager.prototype.createTouchHook = function () { + var _this = this; + var hookDiv = document.createElement('button'); + hookDiv.style.width = DIV_HOOK_SIZE + "px"; + hookDiv.style.height = DIV_HOOK_SIZE + "px"; + hookDiv.style.position = 'absolute'; + hookDiv.style.top = DIV_HOOK_POS_X + "px"; + hookDiv.style.left = DIV_HOOK_POS_Y + "px"; + hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(); + hookDiv.style.backgroundColor = '#FF0000'; + hookDiv.title = 'select to enable accessability for this content'; + hookDiv.addEventListener('focus', function () { + _this._isMobileAccessibility = true; + _this.activate(); + _this.destroyTouchHook(); + }); + document.body.appendChild(hookDiv); + this._hookDiv = hookDiv; + }; + /** + * Destroys the touch hooks. + * + * @private + */ + AccessibilityManager.prototype.destroyTouchHook = function () { + if (!this._hookDiv) { + return; } - else - { - div.setAttribute('aria-live', 'polite'); + document.body.removeChild(this._hookDiv); + this._hookDiv = null; + }; + /** + * Activating will cause the Accessibility layer to be shown. + * This is called when a user presses the tab key. + * + * @private + */ + AccessibilityManager.prototype.activate = function () { + if (this._isActive) { + return; } - - if (navigator.userAgent.match(/rv:.*Gecko\//)) - { - // FireFox needs this to announce only the new button name - div.setAttribute('aria-relevant', 'additions'); + this._isActive = true; + window.document.addEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown, false); + // TODO: Remove casting when CanvasRenderer is converted + this.renderer.on('postrender', this.update, this); + if (this.renderer.view.parentNode) { + this.renderer.view.parentNode.appendChild(this.div); } - else - { - // required by IE, other browsers don't much care - div.setAttribute('aria-relevant', 'text'); + }; + /** + * Deactivating will cause the Accessibility layer to be hidden. + * This is called when a user moves the mouse. + * + * @private + */ + AccessibilityManager.prototype.deactivate = function () { + if (!this._isActive || this._isMobileAccessibility) { + return; } - - div.addEventListener('click', this._onClick.bind(this)); - div.addEventListener('focus', this._onFocus.bind(this)); - div.addEventListener('focusout', this._onFocusOut.bind(this)); - } - - // set pointer events - div.style.pointerEvents = displayObject.accessiblePointerEvents; - // set the type, this defaults to button! - div.type = displayObject.accessibleType; - - if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) - { - div.title = displayObject.accessibleTitle; - } - else if (!displayObject.accessibleHint - || displayObject.accessibleHint === null) - { - div.title = "displayObject " + (displayObject.tabIndex); - } - - if (displayObject.accessibleHint - && displayObject.accessibleHint !== null) - { - div.setAttribute('aria-label', displayObject.accessibleHint); - } - - if (this.debug) { this.updateDebugHTML(div); } - - displayObject._accessibleActive = true; - displayObject._accessibleDiv = div; - div.displayObject = displayObject; - - this.children.push(displayObject); - this.div.appendChild(displayObject._accessibleDiv); - displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; - }; - - /** - * Maps the div button press to pixi's InteractionManager (click) - * - * @private - * @param {MouseEvent} e - The click event. - */ - AccessibilityManager.prototype._onClick = function _onClick (e) - { - var interactionManager = this.renderer.plugins.interaction; - - interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData); - interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData); - }; - - /** - * Maps the div focus events to pixi's InteractionManager (mouseover) - * - * @private - * @param {FocusEvent} e - The focus event. - */ - AccessibilityManager.prototype._onFocus = function _onFocus (e) - { - if (!e.target.getAttribute('aria-live', 'off')) - { - e.target.setAttribute('aria-live', 'assertive'); - } - var interactionManager = this.renderer.plugins.interaction; - - interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); - }; - - /** - * Maps the div focus events to pixi's InteractionManager (mouseout) - * - * @private - * @param {FocusEvent} e - The focusout event. - */ - AccessibilityManager.prototype._onFocusOut = function _onFocusOut (e) - { - if (!e.target.getAttribute('aria-live', 'off')) - { - e.target.setAttribute('aria-live', 'polite'); - } - var interactionManager = this.renderer.plugins.interaction; - - interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); - }; - - /** - * Is called when a key is pressed - * - * @private - * @param {KeyboardEvent} e - The keydown event. - */ - AccessibilityManager.prototype._onKeyDown = function _onKeyDown (e) - { - if (e.keyCode !== KEY_CODE_TAB) - { - return; - } - - this.activate(); - }; - - /** - * Is called when the mouse moves across the renderer element - * - * @private - * @param {MouseEvent} e - The mouse event. - */ - AccessibilityManager.prototype._onMouseMove = function _onMouseMove (e) - { - if (e.movementX === 0 && e.movementY === 0) - { - return; - } - - this.deactivate(); - }; - - /** - * Destroys the accessibility manager - * - */ - AccessibilityManager.prototype.destroy = function destroy () - { - this.destroyTouchHook(); - this.div = null; - - for (var i = 0; i < this.children.length; i++) - { - this.children[i].div = null; - } - - window.document.removeEventListener('mousemove', this._onMouseMove, true); - window.removeEventListener('keydown', this._onKeyDown); - - this.pool = null; - this.children = null; - this.renderer = null; - }; - - var accessibility_es = ({ - AccessibilityManager: AccessibilityManager, - accessibleTarget: accessibleTarget - }); + this._isActive = false; + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.addEventListener('keydown', this._onKeyDown, false); + // TODO: Remove casting when CanvasRenderer is converted + this.renderer.off('postrender', this.update); + if (this.div.parentNode) { + this.div.parentNode.removeChild(this.div); + } + }; + /** + * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer. + * + * @private + * @param {PIXI.Container} displayObject - The DisplayObject to check. + */ + AccessibilityManager.prototype.updateAccessibleObjects = function (displayObject) { + if (!displayObject.visible || !displayObject.accessibleChildren) { + return; + } + if (displayObject.accessible && displayObject.interactive) { + if (!displayObject._accessibleActive) { + this.addChild(displayObject); + } + displayObject.renderId = this.renderId; + } + var children = displayObject.children; + for (var i = 0; i < children.length; i++) { + this.updateAccessibleObjects(children[i]); + } + }; + /** + * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects. + * + * @private + */ + AccessibilityManager.prototype.update = function () { + /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex, + * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate, + * so I am just running update every half a second, seems to fix it. + */ + var now = performance.now(); + if (isMobile$1.android.device && now < this.androidUpdateCount) { + return; + } + this.androidUpdateCount = now + this.androidUpdateFrequency; + if (!this.renderer.renderingToScreen) { + return; + } + // update children... + if (this.renderer._lastObjectRendered) { + this.updateAccessibleObjects(this.renderer._lastObjectRendered); + } + // TODO: Remove casting when CanvasRenderer is converted + var rect = this.renderer.view.getBoundingClientRect(); + var resolution = this.renderer.resolution; + var sx = (rect.width / this.renderer.width) * resolution; + var sy = (rect.height / this.renderer.height) * resolution; + var div = this.div; + div.style.left = rect.left + "px"; + div.style.top = rect.top + "px"; + div.style.width = this.renderer.width + "px"; + div.style.height = this.renderer.height + "px"; + for (var i = 0; i < this.children.length; i++) { + var child = this.children[i]; + if (child.renderId !== this.renderId) { + child._accessibleActive = false; + removeItems(this.children, i, 1); + this.div.removeChild(child._accessibleDiv); + this.pool.push(child._accessibleDiv); + child._accessibleDiv = null; + i--; + } + else { + // map div to display.. + div = child._accessibleDiv; + var hitArea = child.hitArea; + var wt = child.worldTransform; + if (child.hitArea) { + div.style.left = (wt.tx + (hitArea.x * wt.a)) * sx + "px"; + div.style.top = (wt.ty + (hitArea.y * wt.d)) * sy + "px"; + div.style.width = hitArea.width * wt.a * sx + "px"; + div.style.height = hitArea.height * wt.d * sy + "px"; + } + else { + hitArea = child.getBounds(); + this.capHitArea(hitArea); + div.style.left = hitArea.x * sx + "px"; + div.style.top = hitArea.y * sy + "px"; + div.style.width = hitArea.width * sx + "px"; + div.style.height = hitArea.height * sy + "px"; + // update button titles and hints if they exist and they've changed + if (div.title !== child.accessibleTitle && child.accessibleTitle !== null) { + div.title = child.accessibleTitle; + } + if (div.getAttribute('aria-label') !== child.accessibleHint + && child.accessibleHint !== null) { + div.setAttribute('aria-label', child.accessibleHint); + } + } + // the title or index may have changed, if so lets update it! + if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) { + div.title = child.accessibleTitle; + div.tabIndex = child.tabIndex; + if (this.debug) + { this.updateDebugHTML(div); } + } + } + } + // increment the render id.. + this.renderId++; + }; + /** + * private function that will visually add the information to the + * accessability div + * + * @param {HTMLElement} div + */ + AccessibilityManager.prototype.updateDebugHTML = function (div) { + div.innerHTML = "type: " + div.type + "
title : " + div.title + "
tabIndex: " + div.tabIndex; + }; + /** + * Adjust the hit area based on the bounds of a display object + * + * @param {PIXI.Rectangle} hitArea - Bounds of the child + */ + AccessibilityManager.prototype.capHitArea = function (hitArea) { + if (hitArea.x < 0) { + hitArea.width += hitArea.x; + hitArea.x = 0; + } + if (hitArea.y < 0) { + hitArea.height += hitArea.y; + hitArea.y = 0; + } + // TODO: Remove casting when CanvasRenderer is converted + if (hitArea.x + hitArea.width > this.renderer.width) { + hitArea.width = this.renderer.width - hitArea.x; + } + if (hitArea.y + hitArea.height > this.renderer.height) { + hitArea.height = this.renderer.height - hitArea.y; + } + }; + /** + * Adds a DisplayObject to the accessibility manager + * + * @private + * @param {PIXI.DisplayObject} displayObject - The child to make accessible. + */ + AccessibilityManager.prototype.addChild = function (displayObject) { + // this.activate(); + var div = this.pool.pop(); + if (!div) { + div = document.createElement('button'); + div.style.width = DIV_TOUCH_SIZE + "px"; + div.style.height = DIV_TOUCH_SIZE + "px"; + div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent'; + div.style.position = 'absolute'; + div.style.zIndex = DIV_TOUCH_ZINDEX.toString(); + div.style.borderStyle = 'none'; + // ARIA attributes ensure that button title and hint updates are announced properly + if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { + // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused. + div.setAttribute('aria-live', 'off'); + } + else { + div.setAttribute('aria-live', 'polite'); + } + if (navigator.userAgent.match(/rv:.*Gecko\//)) { + // FireFox needs this to announce only the new button name + div.setAttribute('aria-relevant', 'additions'); + } + else { + // required by IE, other browsers don't much care + div.setAttribute('aria-relevant', 'text'); + } + div.addEventListener('click', this._onClick.bind(this)); + div.addEventListener('focus', this._onFocus.bind(this)); + div.addEventListener('focusout', this._onFocusOut.bind(this)); + } + // set pointer events + div.style.pointerEvents = displayObject.accessiblePointerEvents; + // set the type, this defaults to button! + div.type = displayObject.accessibleType; + if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null) { + div.title = displayObject.accessibleTitle; + } + else if (!displayObject.accessibleHint + || displayObject.accessibleHint === null) { + div.title = "displayObject " + displayObject.tabIndex; + } + if (displayObject.accessibleHint + && displayObject.accessibleHint !== null) { + div.setAttribute('aria-label', displayObject.accessibleHint); + } + if (this.debug) + { this.updateDebugHTML(div); } + displayObject._accessibleActive = true; + displayObject._accessibleDiv = div; + div.displayObject = displayObject; + this.children.push(displayObject); + this.div.appendChild(displayObject._accessibleDiv); + displayObject._accessibleDiv.tabIndex = displayObject.tabIndex; + }; + /** + * Maps the div button press to pixi's InteractionManager (click) + * + * @private + * @param {MouseEvent} e - The click event. + */ + AccessibilityManager.prototype._onClick = function (e) { + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'click', interactionManager.eventData); + interactionManager.dispatchEvent(e.target.displayObject, 'pointertap', interactionManager.eventData); + interactionManager.dispatchEvent(e.target.displayObject, 'tap', interactionManager.eventData); + }; + /** + * Maps the div focus events to pixi's InteractionManager (mouseover) + * + * @private + * @param {FocusEvent} e - The focus event. + */ + AccessibilityManager.prototype._onFocus = function (e) { + if (!e.target.getAttribute('aria-live')) { + e.target.setAttribute('aria-live', 'assertive'); + } + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'mouseover', interactionManager.eventData); + }; + /** + * Maps the div focus events to pixi's InteractionManager (mouseout) + * + * @private + * @param {FocusEvent} e - The focusout event. + */ + AccessibilityManager.prototype._onFocusOut = function (e) { + if (!e.target.getAttribute('aria-live')) { + e.target.setAttribute('aria-live', 'polite'); + } + // TODO: Remove casting when CanvasRenderer is converted + var interactionManager = this.renderer.plugins.interaction; + interactionManager.dispatchEvent(e.target.displayObject, 'mouseout', interactionManager.eventData); + }; + /** + * Is called when a key is pressed + * + * @private + * @param {KeyboardEvent} e - The keydown event. + */ + AccessibilityManager.prototype._onKeyDown = function (e) { + if (e.keyCode !== KEY_CODE_TAB) { + return; + } + this.activate(); + }; + /** + * Is called when the mouse moves across the renderer element + * + * @private + * @param {MouseEvent} e - The mouse event. + */ + AccessibilityManager.prototype._onMouseMove = function (e) { + if (e.movementX === 0 && e.movementY === 0) { + return; + } + this.deactivate(); + }; + /** + * Destroys the accessibility manager + * + */ + AccessibilityManager.prototype.destroy = function () { + this.destroyTouchHook(); + this.div = null; + window.document.removeEventListener('mousemove', this._onMouseMove, true); + window.removeEventListener('keydown', this._onKeyDown); + this.pool = null; + this.children = null; + this.renderer = null; + }; + return AccessibilityManager; + }()); /*! - * @pixi/ticker - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/ticker - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/ticker is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -13672,11 +13343,11 @@ var PIXI = (function (exports) { * @name UPDATE_PRIORITY * @memberof PIXI * @enum {number} - * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.interaction.InteractionManager} + * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager} * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite} * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}. * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering. - * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.prepare.BasePrepare} utility. + * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility. */ (function (UPDATE_PRIORITY) { @@ -14115,9 +13786,10 @@ var PIXI = (function (exports) { }; Object.defineProperty(Ticker.prototype, "count", { /** - * Counts the number of listeners on this ticker. + * The number of listeners on this ticker, calculated by walking through linked list * - * @returns {number} The number of listeners on this ticker + * @readonly + * @member {number} */ get: function () { if (!this._head) { @@ -14130,7 +13802,7 @@ var PIXI = (function (exports) { } return count; }, - enumerable: true, + enumerable: false, configurable: true }); /** @@ -14249,7 +13921,7 @@ var PIXI = (function (exports) { get: function () { return 1000 / this.elapsedMS; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Ticker.prototype, "minFPS", { @@ -14274,7 +13946,7 @@ var PIXI = (function (exports) { var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS); this._maxElapsedMS = 1 / minFPMS; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Ticker.prototype, "maxFPS", { @@ -14304,7 +13976,7 @@ var PIXI = (function (exports) { this._minElapsedMS = 1 / (maxFPS / 1000); } }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Ticker, "shared", { @@ -14359,12 +14031,12 @@ var PIXI = (function (exports) { } return Ticker._shared; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Ticker, "system", { /** - * The system ticker instance used by {@link PIXI.interaction.InteractionManager} and by + * The system ticker instance used by {@link PIXI.InteractionManager} and by * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused, * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused. * @@ -14381,7 +14053,7 @@ var PIXI = (function (exports) { } return Ticker._system; }, - enumerable: true, + enumerable: false, configurable: true }); return Ticker; @@ -14486,8 +14158,8 @@ var PIXI = (function (exports) { }()); /*! - * @pixi/interaction - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/interaction - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/interaction is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -14497,606 +14169,571 @@ var PIXI = (function (exports) { * Holds all information related to an Interaction event * * @class - * @memberof PIXI.interaction + * @memberof PIXI */ - var InteractionData = function InteractionData() - { - /** - * This point stores the global coords of where the touch/mouse event happened - * - * @member {PIXI.Point} - */ - this.global = new Point(); - - /** - * The target Sprite that was interacted with - * - * @member {PIXI.Sprite} - */ - this.target = null; - - /** - * When passed to an event handler, this will be the original DOM Event that was captured - * - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent - * @member {MouseEvent|TouchEvent|PointerEvent} - */ - this.originalEvent = null; - - /** - * Unique identifier for this interaction - * - * @member {number} - */ - this.identifier = null; - - /** - * Indicates whether or not the pointer device that created the event is the primary pointer. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary - * @type {Boolean} - */ - this.isPrimary = false; - - /** - * Indicates which button was pressed on the mouse or pointer device to trigger the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button - * @type {number} - */ - this.button = 0; - - /** - * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. - * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons - * @type {number} - */ - this.buttons = 0; - - /** - * The width of the pointer's contact along the x-axis, measured in CSS pixels. - * radiusX of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width - * @type {number} - */ - this.width = 0; - - /** - * The height of the pointer's contact along the y-axis, measured in CSS pixels. - * radiusY of TouchEvents will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height - * @type {number} - */ - this.height = 0; - - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX - * @type {number} - */ - this.tiltX = 0; - - /** - * The angle, in degrees, between the pointer device and the screen. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY - * @type {number} - */ - this.tiltY = 0; - - /** - * The type of pointer that triggered the event. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType - * @type {string} - */ - this.pointerType = null; - - /** - * Pressure applied by the pointing device during the event. A Touch's force property - * will be represented by this value. - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure - * @type {number} - */ - this.pressure = 0; - - /** - * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. - * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle - * @type {number} - */ - this.rotationAngle = 0; - - /** - * Twist of a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.twist = 0; - - /** - * Barrel pressure on a stylus pointer. - * @see https://w3c.github.io/pointerevents/#pointerevent-interface - * @type {number} - */ - this.tangentialPressure = 0; - }; - - var prototypeAccessors = { pointerId: { configurable: true } }; - - /** - * The unique identifier of the pointer. It will be the same as `identifier`. - * @readonly - * @member {number} - * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId - */ - prototypeAccessors.pointerId.get = function () - { - return this.identifier; - }; - - /** - * This will return the local coordinates of the specified displayObject for this InteractionData - * - * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local - * coords off - * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise - * will create a new point) - * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional - * (otherwise will use the current global coords) - * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative - * to the DisplayObject - */ - InteractionData.prototype.getLocalPosition = function getLocalPosition (displayObject, point, globalPos) - { - return displayObject.worldTransform.applyInverse(globalPos || this.global, point); - }; - - /** - * Copies properties from normalized event data. - * - * @param {Touch|MouseEvent|PointerEvent} event The normalized event data - */ - InteractionData.prototype.copyEvent = function copyEvent (event) - { - // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite - // it with "false" on later events when our shim for it on touch events might not be - // accurate - if (event.isPrimary) - { - this.isPrimary = true; + var InteractionData = /** @class */ (function () { + function InteractionData() { + this.pressure = 0; + this.rotationAngle = 0; + this.twist = 0; + this.tangentialPressure = 0; + /** + * This point stores the global coords of where the touch/mouse event happened + * + * @member {PIXI.Point} + */ + this.global = new Point(); + /** + * The target Sprite that was interacted with + * + * @member {PIXI.Sprite} + */ + this.target = null; + /** + * When passed to an event handler, this will be the original DOM Event that was captured + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent + * @member {MouseEvent|TouchEvent|PointerEvent} + */ + this.originalEvent = null; + /** + * Unique identifier for this interaction + * + * @member {number} + */ + this.identifier = null; + /** + * Indicates whether or not the pointer device that created the event is the primary pointer. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary + * @type {Boolean} + */ + this.isPrimary = false; + /** + * Indicates which button was pressed on the mouse or pointer device to trigger the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + * @type {number} + */ + this.button = 0; + /** + * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered. + * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons + * @type {number} + */ + this.buttons = 0; + /** + * The width of the pointer's contact along the x-axis, measured in CSS pixels. + * radiusX of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width + * @type {number} + */ + this.width = 0; + /** + * The height of the pointer's contact along the y-axis, measured in CSS pixels. + * radiusY of TouchEvents will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height + * @type {number} + */ + this.height = 0; + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX + * @type {number} + */ + this.tiltX = 0; + /** + * The angle, in degrees, between the pointer device and the screen. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY + * @type {number} + */ + this.tiltY = 0; + /** + * The type of pointer that triggered the event. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType + * @type {string} + */ + this.pointerType = null; + /** + * Pressure applied by the pointing device during the event. A Touch's force property + * will be represented by this value. + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure + * @type {number} + */ + this.pressure = 0; + /** + * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch. + * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle + * @type {number} + */ + this.rotationAngle = 0; + /** + * Twist of a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.twist = 0; + /** + * Barrel pressure on a stylus pointer. + * @see https://w3c.github.io/pointerevents/#pointerevent-interface + * @type {number} + */ + this.tangentialPressure = 0; } - this.button = event.button; - // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard - // event.which property instead, which conveys the same information. - this.buttons = Number.isInteger(event.buttons) ? event.buttons : event.which; - this.width = event.width; - this.height = event.height; - this.tiltX = event.tiltX; - this.tiltY = event.tiltY; - this.pointerType = event.pointerType; - this.pressure = event.pressure; - this.rotationAngle = event.rotationAngle; - this.twist = event.twist || 0; - this.tangentialPressure = event.tangentialPressure || 0; - }; + Object.defineProperty(InteractionData.prototype, "pointerId", { + /** + * The unique identifier of the pointer. It will be the same as `identifier`. + * @readonly + * @member {number} + * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId + */ + get: function () { + return this.identifier; + }, + enumerable: false, + configurable: true + }); + /** + * This will return the local coordinates of the specified displayObject for this InteractionData + * + * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local + * coords off + * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise + * will create a new point) + * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional + * (otherwise will use the current global coords) + * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative + * to the DisplayObject + */ + InteractionData.prototype.getLocalPosition = function (displayObject, point, globalPos) { + return displayObject.worldTransform.applyInverse(globalPos || this.global, point); + }; + /** + * Copies properties from normalized event data. + * + * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data + */ + InteractionData.prototype.copyEvent = function (event) { + // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite + // it with "false" on later events when our shim for it on touch events might not be + // accurate + if ('isPrimary' in event && event.isPrimary) { + this.isPrimary = true; + } + this.button = 'button' in event && event.button; + // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard + // event.which property instead, which conveys the same information. + var buttons = 'buttons' in event && event.buttons; + this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which; + this.width = 'width' in event && event.width; + this.height = 'height' in event && event.height; + this.tiltX = 'tiltX' in event && event.tiltX; + this.tiltY = 'tiltY' in event && event.tiltY; + this.pointerType = 'pointerType' in event && event.pointerType; + this.pressure = 'pressure' in event && event.pressure; + this.rotationAngle = 'rotationAngle' in event && event.rotationAngle; + this.twist = ('twist' in event && event.twist) || 0; + this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0; + }; + /** + * Resets the data for pooling. + */ + InteractionData.prototype.reset = function () { + // isPrimary is the only property that we really need to reset - everything else is + // guaranteed to be overwritten + this.isPrimary = false; + }; + return InteractionData; + }()); - /** - * Resets the data for pooling. - */ - InteractionData.prototype.reset = function reset () - { - // isPrimary is the only property that we really need to reset - everything else is - // guaranteed to be overwritten - this.isPrimary = false; - }; - - Object.defineProperties( InteractionData.prototype, prototypeAccessors ); + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$1 = function(d, b) { + extendStatics$1 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$1(d, b); + }; + + function __extends$1(d, b) { + extendStatics$1(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } /** * Event class that mimics native DOM events. * * @class - * @memberof PIXI.interaction + * @memberof PIXI */ - var InteractionEvent = function InteractionEvent() - { + var InteractionEvent = /** @class */ (function () { + function InteractionEvent() { + /** + * Whether this event will continue propagating in the tree. + * + * Remaining events for the {@link stopsPropagatingAt} object + * will still be dispatched. + * + * @member {boolean} + */ + this.stopped = false; + /** + * At which object this event stops propagating. + * + * @private + * @member {PIXI.DisplayObject} + */ + this.stopsPropagatingAt = null; + /** + * Whether we already reached the element we want to + * stop propagating at. This is important for delayed events, + * where we start over deeper in the tree again. + * + * @private + * @member {boolean} + */ + this.stopPropagationHint = false; + /** + * The object which caused this event to be dispatched. + * For listener callback see {@link PIXI.InteractionEvent.currentTarget}. + * + * @member {PIXI.DisplayObject} + */ + this.target = null; + /** + * The object whose event listener’s callback is currently being invoked. + * + * @member {PIXI.DisplayObject} + */ + this.currentTarget = null; + /** + * Type of the event + * + * @member {string} + */ + this.type = null; + /** + * InteractionData related to this event + * + * @member {PIXI.InteractionData} + */ + this.data = null; + } /** - * Whether this event will continue propagating in the tree. + * Prevents event from reaching any objects other than the current object. * - * Remaining events for the {@link stopsPropagatingAt} object - * will still be dispatched. - * - * @member {boolean} */ - this.stopped = false; - + InteractionEvent.prototype.stopPropagation = function () { + this.stopped = true; + this.stopPropagationHint = true; + this.stopsPropagatingAt = this.currentTarget; + }; /** - * At which object this event stops propagating. - * - * @private - * @member {PIXI.DisplayObject} + * Resets the event. */ - this.stopsPropagatingAt = null; - - /** - * Whether we already reached the element we want to - * stop propagating at. This is important for delayed events, - * where we start over deeper in the tree again. - * - * @private - * @member {boolean} - */ - this.stopPropagationHint = false; - - /** - * The object which caused this event to be dispatched. - * For listener callback see {@link PIXI.interaction.InteractionEvent.currentTarget}. - * - * @member {PIXI.DisplayObject} - */ - this.target = null; - - /** - * The object whose event listener’s callback is currently being invoked. - * - * @member {PIXI.DisplayObject} - */ - this.currentTarget = null; - - /** - * Type of the event - * - * @member {string} - */ - this.type = null; - - /** - * InteractionData related to this event - * - * @member {PIXI.interaction.InteractionData} - */ - this.data = null; - }; + InteractionEvent.prototype.reset = function () { + this.stopped = false; + this.stopsPropagatingAt = null; + this.stopPropagationHint = false; + this.currentTarget = null; + this.target = null; + }; + return InteractionEvent; + }()); /** - * Prevents event from reaching any objects other than the current object. - * - */ - InteractionEvent.prototype.stopPropagation = function stopPropagation () - { - this.stopped = true; - this.stopPropagationHint = true; - this.stopsPropagatingAt = this.currentTarget; - }; - - /** - * Resets the event. - */ - InteractionEvent.prototype.reset = function reset () - { - this.stopped = false; - this.stopsPropagatingAt = null; - this.stopPropagationHint = false; - this.currentTarget = null; - this.target = null; - }; - - /** - * DisplayObjects with the {@link PIXI.interaction.interactiveTarget} mixin use this class to track interactions + * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions * * @class * @private - * @memberof PIXI.interaction + * @memberof PIXI */ - var InteractionTrackingData = function InteractionTrackingData(pointerId) - { - this._pointerId = pointerId; - this._flags = InteractionTrackingData.FLAGS.NONE; - }; - - var prototypeAccessors$1 = { pointerId: { configurable: true },flags: { configurable: true },none: { configurable: true },over: { configurable: true },rightDown: { configurable: true },leftDown: { configurable: true } }; - - /** - * - * @private - * @param {number} flag - The interaction flag to set - * @param {boolean} yn - Should the flag be set or unset - */ - InteractionTrackingData.prototype._doSet = function _doSet (flag, yn) - { - if (yn) - { - this._flags = this._flags | flag; + var InteractionTrackingData = /** @class */ (function () { + /** + * @param {number} pointerId - Unique pointer id of the event + * @private + */ + function InteractionTrackingData(pointerId) { + this._pointerId = pointerId; + this._flags = InteractionTrackingData.FLAGS.NONE; } - else - { - this._flags = this._flags & (~flag); - } - }; - - /** - * Unique pointer id of the event - * - * @readonly - * @private - * @member {number} - */ - prototypeAccessors$1.pointerId.get = function () - { - return this._pointerId; - }; - - /** - * State of the tracking data, expressed as bit flags - * - * @private - * @member {number} - */ - prototypeAccessors$1.flags.get = function () - { - return this._flags; - }; - - prototypeAccessors$1.flags.set = function (flags) // eslint-disable-line require-jsdoc - { - this._flags = flags; - }; - - /** - * Is the tracked event inactive (not over or down)? - * - * @private - * @member {number} - */ - prototypeAccessors$1.none.get = function () - { - return this._flags === this.constructor.FLAGS.NONE; - }; - - /** - * Is the tracked event over the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1.over.get = function () - { - return (this._flags & this.constructor.FLAGS.OVER) !== 0; - }; - - prototypeAccessors$1.over.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.OVER, yn); - }; - - /** - * Did the right mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1.rightDown.get = function () - { - return (this._flags & this.constructor.FLAGS.RIGHT_DOWN) !== 0; - }; - - prototypeAccessors$1.rightDown.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.RIGHT_DOWN, yn); - }; - - /** - * Did the left mouse button come down in the DisplayObject? - * - * @private - * @member {boolean} - */ - prototypeAccessors$1.leftDown.get = function () - { - return (this._flags & this.constructor.FLAGS.LEFT_DOWN) !== 0; - }; - - prototypeAccessors$1.leftDown.set = function (yn) // eslint-disable-line require-jsdoc - { - this._doSet(this.constructor.FLAGS.LEFT_DOWN, yn); - }; - - Object.defineProperties( InteractionTrackingData.prototype, prototypeAccessors$1 ); - - InteractionTrackingData.FLAGS = Object.freeze({ - NONE: 0, - OVER: 1 << 0, - LEFT_DOWN: 1 << 1, - RIGHT_DOWN: 1 << 2, - }); + /** + * + * @private + * @param {number} flag - The interaction flag to set + * @param {boolean} yn - Should the flag be set or unset + */ + InteractionTrackingData.prototype._doSet = function (flag, yn) { + if (yn) { + this._flags = this._flags | flag; + } + else { + this._flags = this._flags & (~flag); + } + }; + Object.defineProperty(InteractionTrackingData.prototype, "pointerId", { + /** + * Unique pointer id of the event + * + * @readonly + * @private + * @member {number} + */ + get: function () { + return this._pointerId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "flags", { + /** + * State of the tracking data, expressed as bit flags + * + * @private + * @member {number} + */ + get: function () { + return this._flags; + }, + set: function (flags) { + this._flags = flags; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "none", { + /** + * Is the tracked event inactive (not over or down)? + * + * @private + * @member {number} + */ + get: function () { + return this._flags === InteractionTrackingData.FLAGS.NONE; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "over", { + /** + * Is the tracked event over the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.OVER, yn); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "rightDown", { + /** + * Did the right mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionTrackingData.prototype, "leftDown", { + /** + * Did the left mouse button come down in the DisplayObject? + * + * @private + * @member {boolean} + */ + get: function () { + return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0; + }, + set: function (yn) { + this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn); + }, + enumerable: false, + configurable: true + }); + InteractionTrackingData.FLAGS = Object.freeze({ + NONE: 0, + OVER: 1 << 0, + LEFT_DOWN: 1 << 1, + RIGHT_DOWN: 1 << 2, + }); + return InteractionTrackingData; + }()); /** * Strategy how to search through stage tree for interactive objects * * @private * @class - * @memberof PIXI.interaction + * @memberof PIXI */ - var TreeSearch = function TreeSearch() - { - this._tempPoint = new Point(); - }; - - /** - * Recursive implementation for findHit - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @param {boolean} [interactive] - Whether the displayObject is interactive - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.recursiveFindHit = function recursiveFindHit (interactionEvent, displayObject, func, hitTest, interactive) - { - if (!displayObject || !displayObject.visible) - { - return false; + var TreeSearch = /** @class */ (function () { + function TreeSearch() { + this._tempPoint = new Point(); } - - var point = interactionEvent.data.global; - - // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ - // - // This function will now loop through all objects and then only hit test the objects it HAS - // to, not all of them. MUCH faster.. - // An object will be hit test if the following is true: - // - // 1: It is interactive. - // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. - // - // As another little optimization once an interactive object has been hit we can carry on - // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests - // A final optimization is that an object is not hit test directly if a child has already been hit. - - interactive = displayObject.interactive || interactive; - - var hit = false; - var interactiveParent = interactive; - - // Flag here can set to false if the event is outside the parents hitArea or mask - var hitTestChildren = true; - - // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea - // There is also no longer a need to hitTest children. - if (displayObject.hitArea) - { - if (hitTest) - { - displayObject.worldTransform.applyInverse(point, this._tempPoint); - if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) - { - hitTest = false; - hitTestChildren = false; - } - else - { - hit = true; - } + /** + * Recursive implementation for findHit + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @param {boolean} [interactive] - Whether the displayObject is interactive + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.recursiveFindHit = function (interactionEvent, displayObject, func, hitTest, interactive) { + if (!displayObject || !displayObject.visible) { + return false; } - interactiveParent = false; - } - // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. - // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. - // https://github.com/pixijs/pixi.js/issues/5135 - else if (displayObject._mask) - { - if (hitTest) - { - if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) - { - hitTest = false; - } - } - } - - // ** FREE TIP **! If an object is not interactive or has no buttons in it - // (such as a game scene!) set interactiveChildren to false for that displayObject. - // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. - if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) - { - var children = displayObject.children; - - for (var i = children.length - 1; i >= 0; i--) - { - var child = children[i]; - - // time to get recursive.. if this function will return if something is hit.. - var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); - - if (childHit) - { - // its a good idea to check if a child has lost its parent. - // this means it has been removed whilst looping so its best - if (!child.parent) - { - continue; + var point = interactionEvent.data.global; + // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^ + // + // This function will now loop through all objects and then only hit test the objects it HAS + // to, not all of them. MUCH faster.. + // An object will be hit test if the following is true: + // + // 1: It is interactive. + // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit. + // + // As another little optimization once an interactive object has been hit we can carry on + // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests + // A final optimization is that an object is not hit test directly if a child has already been hit. + interactive = displayObject.interactive || interactive; + var hit = false; + var interactiveParent = interactive; + // Flag here can set to false if the event is outside the parents hitArea or mask + var hitTestChildren = true; + // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea + // There is also no longer a need to hitTest children. + if (displayObject.hitArea) { + if (hitTest) { + displayObject.worldTransform.applyInverse(point, this._tempPoint); + if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y)) { + hitTest = false; + hitTestChildren = false; } - - // we no longer need to hit test any more objects in this container as we we - // now know the parent has been hit - interactiveParent = false; - - // If the child is interactive , that means that the object hit was actually - // interactive and not just the child of an interactive object. - // This means we no longer need to hit test anything else. We still need to run - // through all objects, but we don't need to perform any hit tests. - - if (childHit) - { - if (interactionEvent.target) - { - hitTest = false; + else { + hit = true; + } + } + interactiveParent = false; + } + // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask. + // We still want to hitTestChildren, however, to ensure a mouseout can still be generated. + // https://github.com/pixijs/pixi.js/issues/5135 + else if (displayObject._mask) { + if (hitTest) { + if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point))) { + hitTest = false; + } + } + } + // ** FREE TIP **! If an object is not interactive or has no buttons in it + // (such as a game scene!) set interactiveChildren to false for that displayObject. + // This will allow PixiJS to completely ignore and bypass checking the displayObjects children. + if (hitTestChildren && displayObject.interactiveChildren && displayObject.children) { + var children = displayObject.children; + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + // time to get recursive.. if this function will return if something is hit.. + var childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent); + if (childHit) { + // its a good idea to check if a child has lost its parent. + // this means it has been removed whilst looping so its best + if (!child.parent) { + continue; + } + // we no longer need to hit test any more objects in this container as we we + // now know the parent has been hit + interactiveParent = false; + // If the child is interactive , that means that the object hit was actually + // interactive and not just the child of an interactive object. + // This means we no longer need to hit test anything else. We still need to run + // through all objects, but we don't need to perform any hit tests. + if (childHit) { + if (interactionEvent.target) { + hitTest = false; + } + hit = true; } - hit = true; } } } - } - - // no point running this if the item is not interactive or does not have an interactive parent. - if (interactive) - { - // if we are hit testing (as in we have no hit any objects yet) - // We also don't need to worry about hit testing if once of the displayObjects children - // has already been hit - but only if it was interactive, otherwise we need to keep - // looking for an interactive child, just in case we hit one - if (hitTest && !interactionEvent.target) - { - // already tested against hitArea if it is defined - if (!displayObject.hitArea && displayObject.containsPoint) - { - if (displayObject.containsPoint(point)) - { - hit = true; + // no point running this if the item is not interactive or does not have an interactive parent. + if (interactive) { + // if we are hit testing (as in we have no hit any objects yet) + // We also don't need to worry about hit testing if once of the displayObjects children + // has already been hit - but only if it was interactive, otherwise we need to keep + // looking for an interactive child, just in case we hit one + if (hitTest && !interactionEvent.target) { + // already tested against hitArea if it is defined + if (!displayObject.hitArea && displayObject.containsPoint) { + if (displayObject.containsPoint(point)) { + hit = true; + } + } + } + if (displayObject.interactive) { + if (hit && !interactionEvent.target) { + interactionEvent.target = displayObject; + } + if (func) { + func(interactionEvent, displayObject, !!hit); } } } - - if (displayObject.interactive) - { - if (hit && !interactionEvent.target) - { - interactionEvent.target = displayObject; - } - - if (func) - { - func(interactionEvent, displayObject, !!hit); - } - } - } - - return hit; - }; - - /** - * This function is provides a neat way of crawling through the scene graph and running a - * specified function on all interactive objects it finds. It will also take care of hit - * testing the interactive objects and passes the hit across in the function. - * - * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that - * is tested for collision - * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject - * that will be hit test (recursively crawls its children) - * @param {Function} [func] - the function that will be called on each interactive object. The - * interactionEvent, displayObject and hit will be passed to the function - * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point - * @return {boolean} returns true if the displayObject hit the point - */ - TreeSearch.prototype.findHit = function findHit (interactionEvent, displayObject, func, hitTest) - { - this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); - }; + return hit; + }; + /** + * This function is provides a neat way of crawling through the scene graph and running a + * specified function on all interactive objects it finds. It will also take care of hit + * testing the interactive objects and passes the hit across in the function. + * + * @private + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that + * is tested for collision + * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject + * that will be hit test (recursively crawls its children) + * @param {Function} [func] - the function that will be called on each interactive object. The + * interactionEvent, displayObject and hit will be passed to the function + * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point + * @return {boolean} returns true if the displayObject hit the point + */ + TreeSearch.prototype.findHit = function (interactionEvent, displayObject, func, hitTest) { + this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false); + }; + return TreeSearch; + }()); /** * Interface for classes that represent a hit area. @@ -15110,7 +14747,6 @@ var PIXI = (function (exports) { * @interface IHitArea * @memberof PIXI */ - /** * Checks whether the x and y coordinates given are contained within this area * @@ -15121,25 +14757,23 @@ var PIXI = (function (exports) { * @param {number} y - The Y coordinate of the point to test * @return {boolean} Whether the x/y coordinates are within this area */ - /** * Default property values of interactive objects - * Used by {@link PIXI.interaction.InteractionManager} to automatically give all DisplayObjects these properties + * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties * * @private * @name interactiveTarget * @type {Object} - * @memberof PIXI.interaction + * @memberof PIXI * @example * function MyObject() {} * * Object.assign( * DisplayObject.prototype, - * PIXI.interaction.interactiveTarget + * PIXI.interactiveTarget * ); */ var interactiveTarget = { - /** * Enable interaction events for the DisplayObject. Touch, pointer and mouse * events will not be emitted unless `interactive` is set to `true`. @@ -15154,7 +14788,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ interactive: false, - /** * Determines if the children to the displayObject can be clicked/touched * Setting this to false allows PixiJS to bypass a recursive `hitTest` function @@ -15163,7 +14796,6 @@ var PIXI = (function (exports) { * @memberof PIXI.Container# */ interactiveChildren: true, - /** * Interaction shape. Children will be hit first, then this shape will be checked. * Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds. @@ -15176,7 +14808,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ hitArea: null, - /** * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive * Setting this changes the 'cursor' property to `'pointer'`. @@ -15188,22 +14819,17 @@ var PIXI = (function (exports) { * @member {boolean} * @memberof PIXI.DisplayObject# */ - get buttonMode() - { + get buttonMode() { return this.cursor === 'pointer'; }, - set buttonMode(value) - { - if (value) - { + set buttonMode(value) { + if (value) { this.cursor = 'pointer'; } - else if (this.cursor === 'pointer') - { + else if (this.cursor === 'pointer') { this.cursor = null; } }, - /** * This defines what cursor mode is used when the mouse cursor * is hovered over the displayObject. @@ -15218,7 +14844,6 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ cursor: null, - /** * Internal set of all active pointers, by identifier * @@ -15226,13 +14851,11 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# * @private */ - get trackedPointers() - { - if (this._trackedPointers === undefined) { this._trackedPointers = {}; } - + get trackedPointers() { + if (this._trackedPointers === undefined) + { this._trackedPointers = {}; } return this._trackedPointers; }, - /** * Map of all tracked pointers, by identifier. Use trackedPointers to access. * @@ -15245,9 +14868,7 @@ var PIXI = (function (exports) { // Mix interactiveTarget into DisplayObject.prototype, // after deprecation has been handled DisplayObject.mixin(interactiveTarget); - var MOUSE_POINTER_ID = 1; - // helpers for hitTest() - only used inside hitTest() var hitTestEvent = { target: null, @@ -15255,7 +14876,6 @@ var PIXI = (function (exports) { global: null, }, }; - /** * The interaction manager deals with mouse, touch and pointer events. * @@ -15267,22 +14887,26 @@ var PIXI = (function (exports) { * * @class * @extends PIXI.utils.EventEmitter - * @memberof PIXI.interaction + * @memberof PIXI */ - var InteractionManager = /*@__PURE__*/(function (EventEmitter) { - function InteractionManager(renderer, options) - { - EventEmitter.call(this); - + var InteractionManager = /** @class */ (function (_super) { + __extends$1(InteractionManager, _super); + /** + * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer + * @param {object} [options] - The options for the manager. + * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions. + * @param {number} [options.interactionFrequency=10] - Maximum requency (ms) at pointer over/out states will be checked. + * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}. + */ + function InteractionManager(renderer, options) { + var _this = _super.call(this) || this; options = options || {}; - /** * The renderer this interaction manager works for. * * @member {PIXI.AbstractRenderer} */ - this.renderer = renderer; - + _this.renderer = renderer; /** * Should default browser actions automatically be prevented. * Does not apply to pointer events for backwards compatibility @@ -15292,60 +14916,52 @@ var PIXI = (function (exports) { * @member {boolean} * @default true */ - this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; - + _this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true; /** * Maximum requency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}. * * @member {number} * @default 10 */ - this.interactionFrequency = options.interactionFrequency || 10; - + _this.interactionFrequency = options.interactionFrequency || 10; /** * The mouse data * - * @member {PIXI.interaction.InteractionData} + * @member {PIXI.InteractionData} */ - this.mouse = new InteractionData(); - this.mouse.identifier = MOUSE_POINTER_ID; - + _this.mouse = new InteractionData(); + _this.mouse.identifier = MOUSE_POINTER_ID; // setting the mouse to start off far off screen will mean that mouse over does // not get called before we even move the mouse. - this.mouse.global.set(-999999); - + _this.mouse.global.set(-999999); /** * Actively tracked InteractionData * * @private - * @member {Object.} + * @member {Object.} */ - this.activeInteractionData = {}; - this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse; - + _this.activeInteractionData = {}; + _this.activeInteractionData[MOUSE_POINTER_ID] = _this.mouse; /** * Pool of unused InteractionData * * @private - * @member {PIXI.interaction.InteractionData[]} + * @member {PIXI.InteractionData[]} */ - this.interactionDataPool = []; - + _this.interactionDataPool = []; /** * An event data object to handle all the event tracking/dispatching * * @member {object} */ - this.eventData = new InteractionEvent(); - + _this.eventData = new InteractionEvent(); /** * The DOM element to bind to. * * @protected * @member {HTMLElement} */ - this.interactionDOMElement = null; - + _this.interactionDOMElement = null; /** * This property determines if mousemove and touchmove events are fired only when the cursor * is over the object. @@ -15357,32 +14973,28 @@ var PIXI = (function (exports) { * @member {boolean} * @default false */ - this.moveWhenInside = false; - + _this.moveWhenInside = false; /** * Have events been attached to the dom element? * * @protected * @member {boolean} */ - this.eventsAdded = false; - + _this.eventsAdded = false; /** * Has the system ticker been added? * * @protected * @member {boolean} */ - this.tickerAdded = false; - + _this.tickerAdded = false; /** * Is the mouse hovering over the renderer? * * @protected * @member {boolean} */ - this.mouseOverRenderer = false; - + _this.mouseOverRenderer = false; /** * Does the device support touch events * https://www.w3.org/TR/touch-events/ @@ -15390,8 +15002,7 @@ var PIXI = (function (exports) { * @readonly * @member {boolean} */ - this.supportsTouchEvents = 'ontouchstart' in window; - + _this.supportsTouchEvents = 'ontouchstart' in window; /** * Does the device support pointer events * https://www.w3.org/Submission/pointer-events/ @@ -15399,51 +15010,43 @@ var PIXI = (function (exports) { * @readonly * @member {boolean} */ - this.supportsPointerEvents = !!window.PointerEvent; - + _this.supportsPointerEvents = !!window.PointerEvent; // this will make it so that you don't have to call bind all the time - /** * @private * @member {Function} */ - this.onPointerUp = this.onPointerUp.bind(this); - this.processPointerUp = this.processPointerUp.bind(this); - + _this.onPointerUp = _this.onPointerUp.bind(_this); + _this.processPointerUp = _this.processPointerUp.bind(_this); /** * @private * @member {Function} */ - this.onPointerCancel = this.onPointerCancel.bind(this); - this.processPointerCancel = this.processPointerCancel.bind(this); - + _this.onPointerCancel = _this.onPointerCancel.bind(_this); + _this.processPointerCancel = _this.processPointerCancel.bind(_this); /** * @private * @member {Function} */ - this.onPointerDown = this.onPointerDown.bind(this); - this.processPointerDown = this.processPointerDown.bind(this); - + _this.onPointerDown = _this.onPointerDown.bind(_this); + _this.processPointerDown = _this.processPointerDown.bind(_this); /** * @private * @member {Function} */ - this.onPointerMove = this.onPointerMove.bind(this); - this.processPointerMove = this.processPointerMove.bind(this); - + _this.onPointerMove = _this.onPointerMove.bind(_this); + _this.processPointerMove = _this.processPointerMove.bind(_this); /** * @private * @member {Function} */ - this.onPointerOut = this.onPointerOut.bind(this); - this.processPointerOverOut = this.processPointerOverOut.bind(this); - + _this.onPointerOut = _this.onPointerOut.bind(_this); + _this.processPointerOverOut = _this.processPointerOverOut.bind(_this); /** * @private * @member {Function} */ - this.onPointerOver = this.onPointerOver.bind(this); - + _this.onPointerOver = _this.onPointerOver.bind(_this); /** * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor * values, objects are handled as dictionaries of CSS values for interactionDOMElement, @@ -15451,289 +15054,258 @@ var PIXI = (function (exports) { * Default CSS cursor values are provided for 'default' and 'pointer' modes. * @member {Object.} */ - this.cursorStyles = { + _this.cursorStyles = { default: 'inherit', pointer: 'pointer', }; - /** * The mode of the cursor that is being used. * The value of this is a key from the cursorStyles dictionary. * * @member {string} */ - this.currentCursorMode = null; - + _this.currentCursorMode = null; /** * Internal cached let. * * @private * @member {string} */ - this.cursor = null; - + _this.cursor = null; /** * The current resolution / device pixel ratio. * * @member {number} * @default 1 */ - this.resolution = 1; - + _this.resolution = 1; /** * Delayed pointer events. Used to guarantee correct ordering of over/out events. * * @private * @member {Array} */ - this.delayedEvents = []; - + _this.delayedEvents = []; /** * TreeSearch component that is used to hitTest stage tree * * @private - * @member {PIXI.interaction.TreeSearch} + * @member {PIXI.TreeSearch} */ - this.search = new TreeSearch(); - + _this.search = new TreeSearch(); + /** + * Used as a last rendered object in case renderer doesnt have _lastObjectRendered + * @member {DisplayObject} + * @private + */ + _this._tempDisplayObject = new TemporaryDisplayObject(); /** * Fired when a pointer device button (usually a mouse left-button) is pressed on the display * object. * - * @event PIXI.interaction.InteractionManager#mousedown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mousedown + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is pressed * on the display object. * - * @event PIXI.interaction.InteractionManager#rightdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#rightdown + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is released over the display * object. * - * @event PIXI.interaction.InteractionManager#mouseup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mouseup + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is released * over the display object. * - * @event PIXI.interaction.InteractionManager#rightup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#rightup + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is pressed and released on * the display object. * - * @event PIXI.interaction.InteractionManager#click - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#click + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is pressed * and released on the display object. * - * @event PIXI.interaction.InteractionManager#rightclick - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#rightclick + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is released outside the * display object that initially registered a - * [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown}. + * [mousedown]{@link PIXI.InteractionManager#event:mousedown}. * - * @event PIXI.interaction.InteractionManager#mouseupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mouseupoutside + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is released * outside the display object that initially registered a - * [rightdown]{@link PIXI.interaction.InteractionManager#event:rightdown}. + * [rightdown]{@link PIXI.InteractionManager#event:rightdown}. * - * @event PIXI.interaction.InteractionManager#rightupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#rightupoutside + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved while over the display object * - * @event PIXI.interaction.InteractionManager#mousemove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mousemove + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved onto the display object * - * @event PIXI.interaction.InteractionManager#mouseover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mouseover + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved off the display object * - * @event PIXI.interaction.InteractionManager#mouseout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#mouseout + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is pressed on the display object. * - * @event PIXI.interaction.InteractionManager#pointerdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointerdown + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is released over the display object. * Not always fired when some buttons are held down while others are released. In those cases, - * use [mousedown]{@link PIXI.interaction.InteractionManager#event:mousedown} and - * [mouseup]{@link PIXI.interaction.InteractionManager#event:mouseup} instead. + * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and + * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead. * - * @event PIXI.interaction.InteractionManager#pointerup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointerup + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when the operating system cancels a pointer event * - * @event PIXI.interaction.InteractionManager#pointercancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointercancel + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is pressed and released on the display object. * - * @event PIXI.interaction.InteractionManager#pointertap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointertap + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is released outside the display object that initially - * registered a [pointerdown]{@link PIXI.interaction.InteractionManager#event:pointerdown}. + * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}. * - * @event PIXI.interaction.InteractionManager#pointerupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointerupoutside + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved while over the display object * - * @event PIXI.interaction.InteractionManager#pointermove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointermove + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved onto the display object * - * @event PIXI.interaction.InteractionManager#pointerover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointerover + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved off the display object * - * @event PIXI.interaction.InteractionManager#pointerout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#pointerout + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is placed on the display object. * - * @event PIXI.interaction.InteractionManager#touchstart - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#touchstart + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is removed from the display object. * - * @event PIXI.interaction.InteractionManager#touchend - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#touchend + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when the operating system cancels a touch * - * @event PIXI.interaction.InteractionManager#touchcancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#touchcancel + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is placed and removed from the display object. * - * @event PIXI.interaction.InteractionManager#tap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#tap + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is removed outside of the display object that initially - * registered a [touchstart]{@link PIXI.interaction.InteractionManager#event:touchstart}. + * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}. * - * @event PIXI.interaction.InteractionManager#touchendoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#touchendoutside + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is moved along the display object. * - * @event PIXI.interaction.InteractionManager#touchmove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @event PIXI.InteractionManager#touchmove + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is pressed on the display. * object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mousedown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is pressed * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#rightdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is released over the display * object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mouseup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is released * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#rightup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is pressed and released on * the display object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#click - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is pressed * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#rightclick - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button (usually a mouse left-button) is released outside the * display object that initially registered a @@ -15741,9 +15313,8 @@ var PIXI = (function (exports) { * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mouseupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device secondary button (usually a mouse right-button) is released * outside the display object that initially registered a @@ -15751,182 +15322,168 @@ var PIXI = (function (exports) { * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#rightupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved while over the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mousemove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved onto the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mouseover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device (usually a mouse) is moved off the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#mouseout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is pressed on the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointerdown - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is released over the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointerup - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when the operating system cancels a pointer event. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointercancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is pressed and released on the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointertap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device button is released outside the display object that initially * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointerupoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved while over the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointermove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved onto the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointerover - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a pointer device is moved off the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#pointerout - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is placed on the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#touchstart - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is removed from the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#touchend - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when the operating system cancels a touch. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#touchcancel - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is placed and removed from the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#tap - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is removed outside of the display object that initially * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#touchendoutside - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - /** * Fired when a touch point is moved along the display object. * DisplayObject's `interactive` property must be set to `true` to fire event. * * @event PIXI.DisplayObject#touchmove - * @param {PIXI.interaction.InteractionEvent} event - Interaction event + * @param {PIXI.InteractionEvent} event - Interaction event */ - - this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; - - this.setTargetElement(this.renderer.view, this.renderer.resolution); + _this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true; + _this.setTargetElement(_this.renderer.view, _this.renderer.resolution); + return _this; } - - if ( EventEmitter ) { InteractionManager.__proto__ = EventEmitter; } - InteractionManager.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - InteractionManager.prototype.constructor = InteractionManager; - - var prototypeAccessors = { useSystemTicker: { configurable: true } }; - - /** - * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. - * - * @member {boolean} - * @default true - */ - prototypeAccessors.useSystemTicker.get = function () - { - return this._useSystemTicker; - }; - prototypeAccessors.useSystemTicker.set = function (useSystemTicker) - { - this._useSystemTicker = useSystemTicker; - - if (useSystemTicker) - { - this.addTickerListener(); - } - else - { - this.removeTickerListener(); - } - }; - + Object.defineProperty(InteractionManager.prototype, "useSystemTicker", { + /** + * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}. + * + * @member {boolean} + * @default true + */ + get: function () { + return this._useSystemTicker; + }, + set: function (useSystemTicker) { + this._useSystemTicker = useSystemTicker; + if (useSystemTicker) { + this.addTickerListener(); + } + else { + this.removeTickerListener(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(InteractionManager.prototype, "lastObjectRendered", { + /** + * Last rendered object or temp object + * @readonly + * @protected + * @member {PIXI.DisplayObject} + */ + get: function () { + return this.renderer._lastObjectRendered || this._tempDisplayObject; + }, + enumerable: false, + configurable: true + }); /** * Hit tests a point against the display tree, returning the first interactive object that is hit. * @@ -15935,24 +15492,20 @@ var PIXI = (function (exports) { * to the last rendered root of the associated renderer. * @return {PIXI.DisplayObject} The hit display object, if any. */ - InteractionManager.prototype.hitTest = function hitTest (globalPoint, root) - { + InteractionManager.prototype.hitTest = function (globalPoint, root) { // clear the target for our hit test hitTestEvent.target = null; // assign the global point hitTestEvent.data.global = globalPoint; // ensure safety of the root - if (!root) - { - root = this.renderer._lastObjectRendered; + if (!root) { + root = this.lastObjectRendered; } // run the hit test this.processInteractive(hitTestEvent, root, null, true); // return our found object - it'll be null if we didn't hit anything - return hitTestEvent.target; }; - /** * Sets the DOM element which will receive mouse/touch events. This is useful for when you have * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate @@ -15961,85 +15514,61 @@ var PIXI = (function (exports) { * @param {HTMLElement} element - the DOM element which will receive mouse and touch events. * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas). */ - InteractionManager.prototype.setTargetElement = function setTargetElement (element, resolution) - { - if ( resolution === void 0 ) { resolution = 1; } - + InteractionManager.prototype.setTargetElement = function (element, resolution) { + if (resolution === void 0) { resolution = 1; } this.removeTickerListener(); - this.removeEvents(); - this.interactionDOMElement = element; - this.resolution = resolution; - this.addEvents(); - this.addTickerListener(); }; - /** * Add the ticker listener * * @private */ - InteractionManager.prototype.addTickerListener = function addTickerListener () - { - if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) - { + InteractionManager.prototype.addTickerListener = function () { + if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker) { return; } - Ticker.system.add(this.tickerUpdate, this, exports.UPDATE_PRIORITY.INTERACTION); - this.tickerAdded = true; }; - /** * Remove the ticker listener * * @private */ - InteractionManager.prototype.removeTickerListener = function removeTickerListener () - { - if (!this.tickerAdded) - { + InteractionManager.prototype.removeTickerListener = function () { + if (!this.tickerAdded) { return; } - Ticker.system.remove(this.tickerUpdate, this); - this.tickerAdded = false; }; - /** * Registers all the DOM events * * @private */ - InteractionManager.prototype.addEvents = function addEvents () - { - if (this.eventsAdded || !this.interactionDOMElement) - { + InteractionManager.prototype.addEvents = function () { + if (this.eventsAdded || !this.interactionDOMElement) { return; } - - if (window.navigator.msPointerEnabled) - { - this.interactionDOMElement.style['-ms-content-zooming'] = 'none'; - this.interactionDOMElement.style['-ms-touch-action'] = 'none'; + var style = this.interactionDOMElement.style; + if (window.navigator.msPointerEnabled) { + style.msContentZooming = 'none'; + style.msTouchAction = 'none'; } - else if (this.supportsPointerEvents) - { - this.interactionDOMElement.style['touch-action'] = 'none'; + else if (this.supportsPointerEvents) { + style.touchAction = 'none'; } - /** * These events are added first, so that if pointer events are normalized, they are fired * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd */ - if (this.supportsPointerEvents) - { + if (this.supportsPointerEvents) { window.document.addEventListener('pointermove', this.onPointerMove, true); this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, true); // pointerout is fired in addition to pointerup (for touch events) and pointercancel @@ -16050,53 +15579,42 @@ var PIXI = (function (exports) { window.addEventListener('pointercancel', this.onPointerCancel, true); window.addEventListener('pointerup', this.onPointerUp, true); } - else - { + else { window.document.addEventListener('mousemove', this.onPointerMove, true); this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, true); this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, true); this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, true); window.addEventListener('mouseup', this.onPointerUp, true); } - // always look directly for touch events so that we can provide original data // In a future version we should change this to being just a fallback and rely solely on // PointerEvents whenever available - if (this.supportsTouchEvents) - { + if (this.supportsTouchEvents) { this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, true); this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, true); this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, true); this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, true); } - this.eventsAdded = true; }; - /** * Removes all the DOM events that were previously registered * * @private */ - InteractionManager.prototype.removeEvents = function removeEvents () - { - if (!this.eventsAdded || !this.interactionDOMElement) - { + InteractionManager.prototype.removeEvents = function () { + if (!this.eventsAdded || !this.interactionDOMElement) { return; } - - if (window.navigator.msPointerEnabled) - { - this.interactionDOMElement.style['-ms-content-zooming'] = ''; - this.interactionDOMElement.style['-ms-touch-action'] = ''; + var style = this.interactionDOMElement.style; + if (window.navigator.msPointerEnabled) { + style.msContentZooming = ''; + style.msTouchAction = ''; } - else if (this.supportsPointerEvents) - { - this.interactionDOMElement.style['touch-action'] = ''; + else if (this.supportsPointerEvents) { + style.touchAction = ''; } - - if (this.supportsPointerEvents) - { + if (this.supportsPointerEvents) { window.document.removeEventListener('pointermove', this.onPointerMove, true); this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, true); this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, true); @@ -16104,28 +15622,22 @@ var PIXI = (function (exports) { window.removeEventListener('pointercancel', this.onPointerCancel, true); window.removeEventListener('pointerup', this.onPointerUp, true); } - else - { + else { window.document.removeEventListener('mousemove', this.onPointerMove, true); this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, true); this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, true); this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, true); window.removeEventListener('mouseup', this.onPointerUp, true); } - - if (this.supportsTouchEvents) - { + if (this.supportsTouchEvents) { this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, true); this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, true); this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, true); this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, true); } - this.interactionDOMElement = null; - this.eventsAdded = false; }; - /** * Updates the state of interactive objects if at least {@link interactionFrequency} * milliseconds have passed since the last invocation. @@ -16134,92 +15646,58 @@ var PIXI = (function (exports) { * * @param {number} deltaTime - time delta since the last call */ - InteractionManager.prototype.tickerUpdate = function tickerUpdate (deltaTime) - { + InteractionManager.prototype.tickerUpdate = function (deltaTime) { this._deltaTime += deltaTime; - - if (this._deltaTime < this.interactionFrequency) - { + if (this._deltaTime < this.interactionFrequency) { return; } - this._deltaTime = 0; - this.update(); }; - /** * Updates the state of interactive objects. */ - InteractionManager.prototype.update = function update () - { - if (!this.interactionDOMElement) - { + InteractionManager.prototype.update = function () { + if (!this.interactionDOMElement) { return; } - // if the user move the mouse this check has already been done using the mouse move! - if (this.didMove) - { - this.didMove = false; - + if (this._didMove) { + this._didMove = false; return; } - this.cursor = null; - // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind, // but there was a scenario of a display object moving under a static mouse cursor. // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function - for (var k in this.activeInteractionData) - { + for (var k in this.activeInteractionData) { // eslint-disable-next-line no-prototype-builtins - if (this.activeInteractionData.hasOwnProperty(k)) - { + if (this.activeInteractionData.hasOwnProperty(k)) { var interactionData = this.activeInteractionData[k]; - - if (interactionData.originalEvent && interactionData.pointerType !== 'touch') - { - var interactionEvent = this.configureInteractionEventForDOMEvent( - this.eventData, - interactionData.originalEvent, - interactionData - ); - - this.processInteractive( - interactionEvent, - this.renderer._lastObjectRendered, - this.processPointerOverOut, - true - ); + if (interactionData.originalEvent && interactionData.pointerType !== 'touch') { + var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, interactionData.originalEvent, interactionData); + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, true); } } } - this.setCursorMode(this.cursor); }; - /** * Sets the current cursor mode, handling any callbacks or CSS style changes. * * @param {string} mode - cursor mode, a key from the cursorStyles dictionary */ - InteractionManager.prototype.setCursorMode = function setCursorMode (mode) - { + InteractionManager.prototype.setCursorMode = function (mode) { mode = mode || 'default'; // if the mode didn't actually change, bail early - if (this.currentCursorMode === mode) - { + if (this.currentCursorMode === mode) { return; } this.currentCursorMode = mode; var style = this.cursorStyles[mode]; - // only do things if there is a cursor style for it - if (style) - { - switch (typeof style) - { + if (style) { + switch (typeof style) { case 'string': // string styles are handled as cursor CSS this.interactionDOMElement.style.cursor = style; @@ -16235,40 +15713,32 @@ var PIXI = (function (exports) { break; } } - else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) - { + else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) { // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry // for the mode, then assume that the dev wants it to be CSS for the cursor. this.interactionDOMElement.style.cursor = mode; } }; - /** * Dispatches an event on the display object that was interacted with * * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question * @param {string} eventString - the name of the event (e.g, mousedown) - * @param {object} eventData - the event data object + * @param {PIXI.InteractionEvent} eventData - the event data object * @private */ - InteractionManager.prototype.dispatchEvent = function dispatchEvent (displayObject, eventString, eventData) - { + InteractionManager.prototype.dispatchEvent = function (displayObject, eventString, eventData) { // Even if the event was stopped, at least dispatch any remaining events // for the same display object. - if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) - { + if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt) { eventData.currentTarget = displayObject; eventData.type = eventString; - displayObject.emit(eventString, eventData); - - if (displayObject[eventString]) - { + if (displayObject[eventString]) { displayObject[eventString](eventData); } } }; - /** * Puts a event on a queue to be dispatched later. This is used to guarantee correct * ordering of over/out events. @@ -16278,47 +15748,38 @@ var PIXI = (function (exports) { * @param {object} eventData - the event data object * @private */ - InteractionManager.prototype.delayDispatchEvent = function delayDispatchEvent (displayObject, eventString, eventData) - { + InteractionManager.prototype.delayDispatchEvent = function (displayObject, eventString, eventData) { this.delayedEvents.push({ displayObject: displayObject, eventString: eventString, eventData: eventData }); }; - /** * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The * resulting value is stored in the point. This takes into account the fact that the DOM * element could be scaled and positioned anywhere on the screen. * - * @param {PIXI.Point} point - the point that the result will be stored in + * @param {PIXI.IPointData} point - the point that the result will be stored in * @param {number} x - the x coord of the position to map * @param {number} y - the y coord of the position to map */ - InteractionManager.prototype.mapPositionToPoint = function mapPositionToPoint (point, x, y) - { + InteractionManager.prototype.mapPositionToPoint = function (point, x, y) { var rect; - // IE 11 fix - if (!this.interactionDOMElement.parentElement) - { + if (!this.interactionDOMElement.parentElement) { rect = { x: 0, y: 0, width: 0, height: 0 }; } - else - { + else { rect = this.interactionDOMElement.getBoundingClientRect(); } - var resolutionMultiplier = 1.0 / this.resolution; - point.x = ((x - rect.left) * (this.interactionDOMElement.width / rect.width)) * resolutionMultiplier; point.y = ((y - rect.top) * (this.interactionDOMElement.height / rect.height)) * resolutionMultiplier; }; - /** * This function is provides a neat way of crawling through the scene graph and running a * specified function on all interactive objects it finds. It will also take care of hit * testing the interactive objects and passes the hit across in the function. * * @protected - * @param {PIXI.interaction.InteractionEvent} interactionEvent - event containing the point that + * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that * is tested for collision * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject * that will be hit test (recursively crawls its children) @@ -16327,146 +15788,99 @@ var PIXI = (function (exports) { * @param {boolean} [hitTest] - indicates whether we want to calculate hits * or just iterate through all interactive objects */ - InteractionManager.prototype.processInteractive = function processInteractive (interactionEvent, displayObject, func, hitTest) - { + InteractionManager.prototype.processInteractive = function (interactionEvent, displayObject, func, hitTest) { var hit = this.search.findHit(interactionEvent, displayObject, func, hitTest); - var delayedEvents = this.delayedEvents; - - if (!delayedEvents.length) - { + if (!delayedEvents.length) { return hit; } // Reset the propagation hint, because we start deeper in the tree again. interactionEvent.stopPropagationHint = false; - var delayedLen = delayedEvents.length; - this.delayedEvents = []; - - for (var i = 0; i < delayedLen; i++) - { - var ref = delayedEvents[i]; - var displayObject$1 = ref.displayObject; - var eventString = ref.eventString; - var eventData = ref.eventData; - + for (var i = 0; i < delayedLen; i++) { + var _a = delayedEvents[i], displayObject_1 = _a.displayObject, eventString = _a.eventString, eventData = _a.eventData; // When we reach the object we wanted to stop propagating at, // set the propagation hint. - if (eventData.stopsPropagatingAt === displayObject$1) - { + if (eventData.stopsPropagatingAt === displayObject_1) { eventData.stopPropagationHint = true; } - - this.dispatchEvent(displayObject$1, eventString, eventData); + this.dispatchEvent(displayObject_1, eventString, eventData); } - return hit; }; - /** * Is called when the pointer button is pressed down on the renderer element * * @private * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down */ - InteractionManager.prototype.onPointerDown = function onPointerDown (originalEvent) - { + InteractionManager.prototype.onPointerDown = function (originalEvent) { // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } var events = this.normalizeToPointerData(originalEvent); - /** * No need to prevent default on natural pointer events, as there are no side effects * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser, * so still need to be prevented. */ - // Guaranteed that there will be at least one event in events, and all events must have the same pointer type - - if (this.autoPreventDefault && events[0].isNormalized) - { + if (this.autoPreventDefault && events[0].isNormalized) { var cancelable = originalEvent.cancelable || !('cancelable' in originalEvent); - - if (cancelable) - { + if (cancelable) { originalEvent.preventDefault(); } } - var eventLen = events.length; - - for (var i = 0; i < eventLen; i++) - { + for (var i = 0; i < eventLen; i++) { var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerDown, true); - + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true); this.emit('pointerdown', interactionEvent); - if (event.pointerType === 'touch') - { + if (event.pointerType === 'touch') { this.emit('touchstart', interactionEvent); } // emit a mouse event for "pen" pointers, the way a browser would emit a fallback event - else if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { + else if (event.pointerType === 'mouse' || event.pointerType === 'pen') { var isRightButton = event.button === 2; - this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData); } } }; - /** * Processes the result of the pointer down check and dispatches the event if need be * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested * @param {boolean} hit - the result of the hit test on the display object */ - InteractionManager.prototype.processPointerDown = function processPointerDown (interactionEvent, displayObject, hit) - { + InteractionManager.prototype.processPointerDown = function (interactionEvent, displayObject, hit) { var data = interactionEvent.data; var id = interactionEvent.data.identifier; - - if (hit) - { - if (!displayObject.trackedPointers[id]) - { + if (hit) { + if (!displayObject.trackedPointers[id]) { displayObject.trackedPointers[id] = new InteractionTrackingData(id); } this.dispatchEvent(displayObject, 'pointerdown', interactionEvent); - - if (data.pointerType === 'touch') - { + if (data.pointerType === 'touch') { this.dispatchEvent(displayObject, 'touchstart', interactionEvent); } - else if (data.pointerType === 'mouse' || data.pointerType === 'pen') - { + else if (data.pointerType === 'mouse' || data.pointerType === 'pen') { var isRightButton = data.button === 2; - - if (isRightButton) - { + if (isRightButton) { displayObject.trackedPointers[id].rightDown = true; } - else - { + else { displayObject.trackedPointers[id].leftDown = true; } - this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent); } } }; - /** * Is called when the pointer button is released on the renderer element * @@ -16475,176 +15889,127 @@ var PIXI = (function (exports) { * @param {boolean} cancelled - true if the pointer is cancelled * @param {Function} func - Function passed to {@link processInteractive} */ - InteractionManager.prototype.onPointerComplete = function onPointerComplete (originalEvent, cancelled, func) - { + InteractionManager.prototype.onPointerComplete = function (originalEvent, cancelled, func) { var events = this.normalizeToPointerData(originalEvent); - var eventLen = events.length; - // if the event wasn't targeting our canvas, then consider it to be pointerupoutside // in all cases (unless it was a pointercancel) var eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : ''; - - for (var i = 0; i < eventLen; i++) - { + for (var i = 0; i < eventLen; i++) { var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - // perform hit testing for events targeting our canvas or cancel events - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, func, cancelled || !eventAppend); - - this.emit(cancelled ? 'pointercancel' : ("pointerup" + eventAppend), interactionEvent); - - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { + this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend); + this.emit(cancelled ? 'pointercancel' : "pointerup" + eventAppend, interactionEvent); + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { var isRightButton = event.button === 2; - - this.emit(isRightButton ? ("rightup" + eventAppend) : ("mouseup" + eventAppend), interactionEvent); + this.emit(isRightButton ? "rightup" + eventAppend : "mouseup" + eventAppend, interactionEvent); } - else if (event.pointerType === 'touch') - { - this.emit(cancelled ? 'touchcancel' : ("touchend" + eventAppend), interactionEvent); - this.releaseInteractionDataForPointerId(event.pointerId, interactionData); + else if (event.pointerType === 'touch') { + this.emit(cancelled ? 'touchcancel' : "touchend" + eventAppend, interactionEvent); + this.releaseInteractionDataForPointerId(event.pointerId); } } }; - /** * Is called when the pointer button is cancelled * * @private * @param {PointerEvent} event - The DOM event of a pointer button being released */ - InteractionManager.prototype.onPointerCancel = function onPointerCancel (event) - { + InteractionManager.prototype.onPointerCancel = function (event) { // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } - + if (this.supportsTouchEvents && event.pointerType === 'touch') + { return; } this.onPointerComplete(event, true, this.processPointerCancel); }; - /** * Processes the result of the pointer cancel check and dispatches the event if need be * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested */ - InteractionManager.prototype.processPointerCancel = function processPointerCancel (interactionEvent, displayObject) - { + InteractionManager.prototype.processPointerCancel = function (interactionEvent, displayObject) { var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - - if (displayObject.trackedPointers[id] !== undefined) - { + if (displayObject.trackedPointers[id] !== undefined) { delete displayObject.trackedPointers[id]; this.dispatchEvent(displayObject, 'pointercancel', interactionEvent); - - if (data.pointerType === 'touch') - { + if (data.pointerType === 'touch') { this.dispatchEvent(displayObject, 'touchcancel', interactionEvent); } } }; - /** * Is called when the pointer button is released on the renderer element * * @private * @param {PointerEvent} event - The DOM event of a pointer button being released */ - InteractionManager.prototype.onPointerUp = function onPointerUp (event) - { + InteractionManager.prototype.onPointerUp = function (event) { // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && event.pointerType === 'touch') { return; } - + if (this.supportsTouchEvents && event.pointerType === 'touch') + { return; } this.onPointerComplete(event, false, this.processPointerUp); }; - /** * Processes the result of the pointer up check and dispatches the event if need be * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested * @param {boolean} hit - the result of the hit test on the display object */ - InteractionManager.prototype.processPointerUp = function processPointerUp (interactionEvent, displayObject, hit) - { + InteractionManager.prototype.processPointerUp = function (interactionEvent, displayObject, hit) { var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var trackingData = displayObject.trackedPointers[id]; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); // need to track mouse down status in the mouse block so that we can emit // event in a later block var isMouseTap = false; - // Mouse only - if (isMouse) - { + if (isMouse) { var isRightButton = data.button === 2; - var flags = InteractionTrackingData.FLAGS; - var test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN; - var isDown = trackingData !== undefined && (trackingData.flags & test); - - if (hit) - { + if (hit) { this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent); - - if (isDown) - { + if (isDown) { this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent); // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap isMouseTap = true; } } - else if (isDown) - { + else if (isDown) { this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent); } // update the down state of the tracking data - if (trackingData) - { - if (isRightButton) - { + if (trackingData) { + if (isRightButton) { trackingData.rightDown = false; } - else - { + else { trackingData.leftDown = false; } } } - // Pointers and Touches, and Mouse - if (hit) - { + if (hit) { this.dispatchEvent(displayObject, 'pointerup', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } - - if (trackingData) - { + if (isTouch) + { this.dispatchEvent(displayObject, 'touchend', interactionEvent); } + if (trackingData) { // emit pointertap if not a mouse, or if the mouse block decided it was a tap - if (!isMouse || isMouseTap) - { + if (!isMouse || isMouseTap) { this.dispatchEvent(displayObject, 'pointertap', interactionEvent); } - if (isTouch) - { + if (isTouch) { this.dispatchEvent(displayObject, 'tap', interactionEvent); // touches are no longer over (if they ever were) when we get the touchend // so we should ensure that we don't keep pretending that they are @@ -16652,252 +16017,186 @@ var PIXI = (function (exports) { } } } - else if (trackingData) - { + else if (trackingData) { this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } + if (isTouch) + { this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent); } } // Only remove the tracking data if there is no over/down state still associated with it - if (trackingData && trackingData.none) - { + if (trackingData && trackingData.none) { delete displayObject.trackedPointers[id]; } }; - /** * Is called when the pointer moves across the renderer element * * @private * @param {PointerEvent} originalEvent - The DOM event of a pointer moving */ - InteractionManager.prototype.onPointerMove = function onPointerMove (originalEvent) - { + InteractionManager.prototype.onPointerMove = function (originalEvent) { // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } var events = this.normalizeToPointerData(originalEvent); - - if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') - { - this.didMove = true; - + if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen') { + this._didMove = true; this.cursor = null; } - var eventLen = events.length; - - for (var i = 0; i < eventLen; i++) - { + for (var i = 0; i < eventLen; i++) { var event = events[i]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = originalEvent; - - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerMove, true); - + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true); this.emit('pointermove', interactionEvent); - if (event.pointerType === 'touch') { this.emit('touchmove', interactionEvent); } - if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mousemove', interactionEvent); } + if (event.pointerType === 'touch') + { this.emit('touchmove', interactionEvent); } + if (event.pointerType === 'mouse' || event.pointerType === 'pen') + { this.emit('mousemove', interactionEvent); } } - - if (events[0].pointerType === 'mouse') - { + if (events[0].pointerType === 'mouse') { this.setCursorMode(this.cursor); - // TODO BUG for parents interactive object (border order issue) } }; - /** * Processes the result of the pointer move check and dispatches the event if need be * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested * @param {boolean} hit - the result of the hit test on the display object */ - InteractionManager.prototype.processPointerMove = function processPointerMove (interactionEvent, displayObject, hit) - { + InteractionManager.prototype.processPointerMove = function (interactionEvent, displayObject, hit) { var data = interactionEvent.data; - var isTouch = data.pointerType === 'touch'; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - - if (isMouse) - { + if (isMouse) { this.processPointerOverOut(interactionEvent, displayObject, hit); } - - if (!this.moveWhenInside || hit) - { + if (!this.moveWhenInside || hit) { this.dispatchEvent(displayObject, 'pointermove', interactionEvent); - if (isTouch) { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } - if (isMouse) { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } + if (isTouch) + { this.dispatchEvent(displayObject, 'touchmove', interactionEvent); } + if (isMouse) + { this.dispatchEvent(displayObject, 'mousemove', interactionEvent); } } }; - /** * Is called when the pointer is moved out of the renderer element * * @private * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out */ - InteractionManager.prototype.onPointerOut = function onPointerOut (originalEvent) - { + InteractionManager.prototype.onPointerOut = function (originalEvent) { // if we support touch events, then only use those for touch events, not pointer events - if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') { return; } - + if (this.supportsTouchEvents && originalEvent.pointerType === 'touch') + { return; } var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOut, so events will always be length 1 var event = events[0]; - - if (event.pointerType === 'mouse') - { + if (event.pointerType === 'mouse') { this.mouseOverRenderer = false; this.setCursorMode(null); } - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - - this.processInteractive(interactionEvent, this.renderer._lastObjectRendered, this.processPointerOverOut, false); - + this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false); this.emit('pointerout', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mouseout', interactionEvent); } - else - { + else { // we can get touchleave events after touchend, so we want to make sure we don't // introduce memory leaks this.releaseInteractionDataForPointerId(interactionData.identifier); } }; - /** * Processes the result of the pointer over/out check and dispatches the event if need be * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event + * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested * @param {boolean} hit - the result of the hit test on the display object */ - InteractionManager.prototype.processPointerOverOut = function processPointerOverOut (interactionEvent, displayObject, hit) - { + InteractionManager.prototype.processPointerOverOut = function (interactionEvent, displayObject, hit) { var data = interactionEvent.data; - var id = interactionEvent.data.identifier; - var isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen'); - var trackingData = displayObject.trackedPointers[id]; - // if we just moused over the display object, then we need to track that state - if (hit && !trackingData) - { + if (hit && !trackingData) { trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id); } - - if (trackingData === undefined) { return; } - - if (hit && this.mouseOverRenderer) - { - if (!trackingData.over) - { + if (trackingData === undefined) + { return; } + if (hit && this.mouseOverRenderer) { + if (!trackingData.over) { trackingData.over = true; this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent); - if (isMouse) - { + if (isMouse) { this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent); } } - // only change the cursor if it has not already been changed (by something deeper in the // display tree) - if (isMouse && this.cursor === null) - { + if (isMouse && this.cursor === null) { this.cursor = displayObject.cursor; } } - else if (trackingData.over) - { + else if (trackingData.over) { trackingData.over = false; this.dispatchEvent(displayObject, 'pointerout', this.eventData); - if (isMouse) - { + if (isMouse) { this.dispatchEvent(displayObject, 'mouseout', interactionEvent); } // if there is no mouse down information for the pointer, then it is safe to delete - if (trackingData.none) - { + if (trackingData.none) { delete displayObject.trackedPointers[id]; } } }; - /** * Is called when the pointer is moved into the renderer element * * @private * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view */ - InteractionManager.prototype.onPointerOver = function onPointerOver (originalEvent) - { + InteractionManager.prototype.onPointerOver = function (originalEvent) { var events = this.normalizeToPointerData(originalEvent); - // Only mouse and pointer can call onPointerOver, so events will always be length 1 var event = events[0]; - var interactionData = this.getInteractionDataForPointerId(event); - var interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData); - interactionEvent.data.originalEvent = event; - - if (event.pointerType === 'mouse') - { + if (event.pointerType === 'mouse') { this.mouseOverRenderer = true; } - this.emit('pointerover', interactionEvent); - if (event.pointerType === 'mouse' || event.pointerType === 'pen') - { + if (event.pointerType === 'mouse' || event.pointerType === 'pen') { this.emit('mouseover', interactionEvent); } }; - /** * Get InteractionData for a given pointerId. Store that data as well * * @private * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData - * @return {PIXI.interaction.InteractionData} - Interaction data for the given pointer identifier + * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier */ - InteractionManager.prototype.getInteractionDataForPointerId = function getInteractionDataForPointerId (event) - { + InteractionManager.prototype.getInteractionDataForPointerId = function (event) { var pointerId = event.pointerId; - var interactionData; - - if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') - { + if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse') { interactionData = this.mouse; } - else if (this.activeInteractionData[pointerId]) - { + else if (this.activeInteractionData[pointerId]) { interactionData = this.activeInteractionData[pointerId]; } - else - { + else { interactionData = this.interactionDataPool.pop() || new InteractionData(); interactionData.identifier = pointerId; this.activeInteractionData[pointerId] = interactionData; @@ -16905,57 +16204,44 @@ var PIXI = (function (exports) { // copy properties from the event, so that we can make sure that touch/pointer specific // data is available interactionData.copyEvent(event); - return interactionData; }; - /** * Return unused InteractionData to the pool, for a given pointerId * * @private * @param {number} pointerId - Identifier from a pointer event */ - InteractionManager.prototype.releaseInteractionDataForPointerId = function releaseInteractionDataForPointerId (pointerId) - { + InteractionManager.prototype.releaseInteractionDataForPointerId = function (pointerId) { var interactionData = this.activeInteractionData[pointerId]; - - if (interactionData) - { + if (interactionData) { delete this.activeInteractionData[pointerId]; interactionData.reset(); this.interactionDataPool.push(interactionData); } }; - /** * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData * * @private - * @param {PIXI.interaction.InteractionEvent} interactionEvent - The event to be configured + * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent - * @param {PIXI.interaction.InteractionData} interactionData - The InteractionData that will be paired + * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired * with the InteractionEvent - * @return {PIXI.interaction.InteractionEvent} the interaction event that was passed in + * @return {PIXI.InteractionEvent} the interaction event that was passed in */ - InteractionManager.prototype.configureInteractionEventForDOMEvent = function configureInteractionEventForDOMEvent (interactionEvent, pointerEvent, interactionData) - { + InteractionManager.prototype.configureInteractionEventForDOMEvent = function (interactionEvent, pointerEvent, interactionData) { interactionEvent.data = interactionData; - this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY); - // Not really sure why this is happening, but it's how a previous version handled things - if (pointerEvent.pointerType === 'touch') - { + if (pointerEvent.pointerType === 'touch') { pointerEvent.globalX = interactionData.global.x; pointerEvent.globalY = interactionData.global.y; } - interactionData.originalEvent = pointerEvent; interactionEvent.reset(); - return interactionEvent; }; - /** * Ensures that the original event object contains all data that a regular pointer event would have * @@ -16964,127 +16250,112 @@ var PIXI = (function (exports) { * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer * or mouse event, or a multiple normalized pointer events if there are multiple changed touches */ - InteractionManager.prototype.normalizeToPointerData = function normalizeToPointerData (event) - { + InteractionManager.prototype.normalizeToPointerData = function (event) { var normalizedEvents = []; - - if (this.supportsTouchEvents && event instanceof TouchEvent) - { - for (var i = 0, li = event.changedTouches.length; i < li; i++) - { + if (this.supportsTouchEvents && event instanceof TouchEvent) { + for (var i = 0, li = event.changedTouches.length; i < li; i++) { var touch = event.changedTouches[i]; - - if (typeof touch.button === 'undefined') { touch.button = event.touches.length ? 1 : 0; } - if (typeof touch.buttons === 'undefined') { touch.buttons = event.touches.length ? 1 : 0; } - if (typeof touch.isPrimary === 'undefined') - { + if (typeof touch.button === 'undefined') + { touch.button = event.touches.length ? 1 : 0; } + if (typeof touch.buttons === 'undefined') + { touch.buttons = event.touches.length ? 1 : 0; } + if (typeof touch.isPrimary === 'undefined') { touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart'; } - if (typeof touch.width === 'undefined') { touch.width = touch.radiusX || 1; } - if (typeof touch.height === 'undefined') { touch.height = touch.radiusY || 1; } - if (typeof touch.tiltX === 'undefined') { touch.tiltX = 0; } - if (typeof touch.tiltY === 'undefined') { touch.tiltY = 0; } - if (typeof touch.pointerType === 'undefined') { touch.pointerType = 'touch'; } - if (typeof touch.pointerId === 'undefined') { touch.pointerId = touch.identifier || 0; } - if (typeof touch.pressure === 'undefined') { touch.pressure = touch.force || 0.5; } - if (typeof touch.twist === 'undefined') { touch.twist = 0; } - if (typeof touch.tangentialPressure === 'undefined') { touch.tangentialPressure = 0; } + if (typeof touch.width === 'undefined') + { touch.width = touch.radiusX || 1; } + if (typeof touch.height === 'undefined') + { touch.height = touch.radiusY || 1; } + if (typeof touch.tiltX === 'undefined') + { touch.tiltX = 0; } + if (typeof touch.tiltY === 'undefined') + { touch.tiltY = 0; } + if (typeof touch.pointerType === 'undefined') + { touch.pointerType = 'touch'; } + if (typeof touch.pointerId === 'undefined') + { touch.pointerId = touch.identifier || 0; } + if (typeof touch.pressure === 'undefined') + { touch.pressure = touch.force || 0.5; } + if (typeof touch.twist === 'undefined') + { touch.twist = 0; } + if (typeof touch.tangentialPressure === 'undefined') + { touch.tangentialPressure = 0; } // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven // support, and the fill ins are not quite the same // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top // left is not 0,0 on the page - if (typeof touch.layerX === 'undefined') { touch.layerX = touch.offsetX = touch.clientX; } - if (typeof touch.layerY === 'undefined') { touch.layerY = touch.offsetY = touch.clientY; } - + if (typeof touch.layerX === 'undefined') + { touch.layerX = touch.offsetX = touch.clientX; } + if (typeof touch.layerY === 'undefined') + { touch.layerY = touch.offsetY = touch.clientY; } // mark the touch as normalized, just so that we know we did it touch.isNormalized = true; - normalizedEvents.push(touch); } } // apparently PointerEvent subclasses MouseEvent, so yay - else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) - { - if (typeof event.isPrimary === 'undefined') { event.isPrimary = true; } - if (typeof event.width === 'undefined') { event.width = 1; } - if (typeof event.height === 'undefined') { event.height = 1; } - if (typeof event.tiltX === 'undefined') { event.tiltX = 0; } - if (typeof event.tiltY === 'undefined') { event.tiltY = 0; } - if (typeof event.pointerType === 'undefined') { event.pointerType = 'mouse'; } - if (typeof event.pointerId === 'undefined') { event.pointerId = MOUSE_POINTER_ID; } - if (typeof event.pressure === 'undefined') { event.pressure = 0.5; } - if (typeof event.twist === 'undefined') { event.twist = 0; } - if (typeof event.tangentialPressure === 'undefined') { event.tangentialPressure = 0; } - + else if (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof window.PointerEvent))) { + var tempEvent = event; + if (typeof tempEvent.isPrimary === 'undefined') + { tempEvent.isPrimary = true; } + if (typeof tempEvent.width === 'undefined') + { tempEvent.width = 1; } + if (typeof tempEvent.height === 'undefined') + { tempEvent.height = 1; } + if (typeof tempEvent.tiltX === 'undefined') + { tempEvent.tiltX = 0; } + if (typeof tempEvent.tiltY === 'undefined') + { tempEvent.tiltY = 0; } + if (typeof tempEvent.pointerType === 'undefined') + { tempEvent.pointerType = 'mouse'; } + if (typeof tempEvent.pointerId === 'undefined') + { tempEvent.pointerId = MOUSE_POINTER_ID; } + if (typeof tempEvent.pressure === 'undefined') + { tempEvent.pressure = 0.5; } + if (typeof tempEvent.twist === 'undefined') + { tempEvent.twist = 0; } + if (typeof tempEvent.tangentialPressure === 'undefined') + { tempEvent.tangentialPressure = 0; } // mark the mouse event as normalized, just so that we know we did it - event.isNormalized = true; - + tempEvent.isNormalized = true; + normalizedEvents.push(tempEvent); + } + else { normalizedEvents.push(event); } - else - { - normalizedEvents.push(event); - } - return normalizedEvents; }; - /** * Destroys the interaction manager * */ - InteractionManager.prototype.destroy = function destroy () - { + InteractionManager.prototype.destroy = function () { this.removeEvents(); - this.removeTickerListener(); - this.removeAllListeners(); - this.renderer = null; - this.mouse = null; - this.eventData = null; - this.interactionDOMElement = null; - this.onPointerDown = null; this.processPointerDown = null; - this.onPointerUp = null; this.processPointerUp = null; - this.onPointerCancel = null; this.processPointerCancel = null; - this.onPointerMove = null; this.processPointerMove = null; - this.onPointerOut = null; this.processPointerOverOut = null; - this.onPointerOver = null; - this.search = null; }; - - Object.defineProperties( InteractionManager.prototype, prototypeAccessors ); - return InteractionManager; }(eventemitter3)); - var interaction_es = ({ - InteractionData: InteractionData, - InteractionEvent: InteractionEvent, - InteractionManager: InteractionManager, - InteractionTrackingData: InteractionTrackingData, - interactiveTarget: interactiveTarget - }); - /*! - * @pixi/runner - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/runner - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/runner is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -17136,7 +16407,7 @@ var PIXI = (function (exports) { */ var Runner = /** @class */ (function () { /** - * @param {string} name the function name that will be executed on the listeners added to this Runner. + * @param {string} name - the function name that will be executed on the listeners added to this Runner. */ function Runner(name) { this.items = []; @@ -17243,7 +16514,7 @@ var PIXI = (function (exports) { get: function () { return this.items.length === 0; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Runner.prototype, "name", { @@ -17256,7 +16527,7 @@ var PIXI = (function (exports) { get: function () { return this._name; }, - enumerable: true, + enumerable: false, configurable: true }); return Runner; @@ -17279,653 +16550,47 @@ var PIXI = (function (exports) { }); /*! - * @pixi/core - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/core - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/core is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ /** - * Base resource class for textures that manages validation and uploading, depending on its type. + * The maximum support for using WebGL. If a device does not + * support WebGL version, for instance WebGL 2, it will still + * attempt to fallback support to WebGL 1. If you want to + * explicitly remove feature support to target a more stable + * baseline, prefer a lower environment. * - * Uploading of a base texture to the GPU is required. + * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} + * we disable webgl2 by default for all non-apple mobile devices. * - * @class - * @memberof PIXI.resources + * @static + * @name PREFER_ENV + * @memberof PIXI.settings + * @type {number} + * @default PIXI.ENV.WEBGL2 */ - var Resource = function Resource(width, height) - { - if ( width === void 0 ) { width = 0; } - if ( height === void 0 ) { height = 0; } - - /** - * Internal width of the resource - * @member {number} - * @protected - */ - this._width = width; - - /** - * Internal height of the resource - * @member {number} - * @protected - */ - this._height = height; - - /** - * If resource has been destroyed - * @member {boolean} - * @readonly - * @default false - */ - this.destroyed = false; - - /** - * `true` if resource is created by BaseTexture - * useful for doing cleanup with BaseTexture destroy - * and not cleaning up resources that were created - * externally. - * @member {boolean} - * @protected - */ - this.internal = false; - - /** - * Mini-runner for handling resize events - * - * @member {Runner} - * @private - */ - this.onResize = new Runner('setRealSize', 2); - - /** - * Mini-runner for handling update events - * - * @member {Runner} - * @private - */ - this.onUpdate = new Runner('update'); - - /** - * Handle internal errors, such as loading errors - * - * @member {Runner} - * @private - */ - this.onError = new Runner('onError', 1); - }; - - var prototypeAccessors$2 = { valid: { configurable: true },width: { configurable: true },height: { configurable: true } }; - + settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; /** - * Bind to a parent BaseTexture + * If set to `true`, *only* Textures and BaseTexture objects stored + * in the caches ({@link PIXI.utils.TextureCache TextureCache} and + * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be + * used when calling {@link PIXI.Texture.from Texture.from} or + * {@link PIXI.BaseTexture.from BaseTexture.from}. + * Otherwise, these `from` calls throw an exception. Using this property + * can be useful if you want to enforce preloading all assets with + * {@link PIXI.Loader Loader}. * - * @param {PIXI.BaseTexture} baseTexture - Parent texture + * @static + * @name STRICT_TEXTURE_CACHE + * @memberof PIXI.settings + * @type {boolean} + * @default false */ - Resource.prototype.bind = function bind (baseTexture) - { - this.onResize.add(baseTexture); - this.onUpdate.add(baseTexture); - this.onError.add(baseTexture); - - // Call a resize immediate if we already - // have the width and height of the resource - if (this._width || this._height) - { - this.onResize.run(this._width, this._height); - } - }; - - /** - * Unbind to a parent BaseTexture - * - * @param {PIXI.BaseTexture} baseTexture - Parent texture - */ - Resource.prototype.unbind = function unbind (baseTexture) - { - this.onResize.remove(baseTexture); - this.onUpdate.remove(baseTexture); - this.onError.remove(baseTexture); - }; - - /** - * Trigger a resize event - * @param {number} width X dimension - * @param {number} height Y dimension - */ - Resource.prototype.resize = function resize (width, height) - { - if (width !== this._width || height !== this._height) - { - this._width = width; - this._height = height; - this.onResize.run(width, height); - } - }; - - /** - * Has been validated - * @readonly - * @member {boolean} - */ - prototypeAccessors$2.valid.get = function () - { - return !!this._width && !!this._height; - }; - - /** - * Has been updated trigger event - */ - Resource.prototype.update = function update () - { - if (!this.destroyed) - { - this.onUpdate.run(); - } - }; - - /** - * This can be overridden to start preloading a resource - * or do any other prepare step. - * @protected - * @return {Promise} Handle the validate event - */ - Resource.prototype.load = function load () - { - return Promise.resolve(); - }; - - /** - * The width of the resource. - * - * @member {number} - * @readonly - */ - prototypeAccessors$2.width.get = function () - { - return this._width; - }; - - /** - * The height of the resource. - * - * @member {number} - * @readonly - */ - prototypeAccessors$2.height.get = function () - { - return this._height; - }; - - /** - * Uploads the texture or returns false if it cant for some reason. Override this. - * - * @param {PIXI.Renderer} renderer - yeah, renderer! - * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context - * @returns {boolean} true is success - */ - Resource.prototype.upload = function upload (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars - { - return false; - }; - - /** - * Set the style, optional to override - * - * @param {PIXI.Renderer} renderer - yeah, renderer! - * @param {PIXI.BaseTexture} baseTexture - the texture - * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context - * @returns {boolean} `true` is success - */ - Resource.prototype.style = function style (renderer, baseTexture, glTexture) // eslint-disable-line no-unused-vars - { - return false; - }; - - /** - * Clean up anything, this happens when destroying is ready. - * - * @protected - */ - Resource.prototype.dispose = function dispose () - { - // override - }; - - /** - * Call when destroying resource, unbind any BaseTexture object - * before calling this method, as reference counts are maintained - * internally. - */ - Resource.prototype.destroy = function destroy () - { - if (!this.destroyed) - { - this.destroyed = true; - this.dispose(); - this.onError.removeAll(); - this.onError = null; - this.onResize.removeAll(); - this.onResize = null; - this.onUpdate.removeAll(); - this.onUpdate = null; - } - }; - - Object.defineProperties( Resource.prototype, prototypeAccessors$2 ); - - /** - * Base for all the image/canvas resources - * @class - * @extends PIXI.resources.Resource - * @memberof PIXI.resources - */ - var BaseImageResource = /*@__PURE__*/(function (Resource) { - function BaseImageResource(source) - { - var width = source.naturalWidth || source.videoWidth || source.width; - var height = source.naturalHeight || source.videoHeight || source.height; - - Resource.call(this, width, height); - - /** - * The source element - * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} - * @readonly - */ - this.source = source; - - /** - * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. - * Certain types of media (e.g. video) using `texImage2D` is more performant. - * @member {boolean} - * @default false - * @private - */ - this.noSubImage = false; - } - - if ( Resource ) { BaseImageResource.__proto__ = Resource; } - BaseImageResource.prototype = Object.create( Resource && Resource.prototype ); - BaseImageResource.prototype.constructor = BaseImageResource; - - /** - * Set cross origin based detecting the url and the crossorigin - * @protected - * @param {HTMLElement} element - Element to apply crossOrigin - * @param {string} url - URL to check - * @param {boolean|string} [crossorigin=true] - Cross origin value to use - */ - BaseImageResource.crossOrigin = function crossOrigin (element, url, crossorigin) - { - if (crossorigin === undefined && url.indexOf('data:') !== 0) - { - element.crossOrigin = determineCrossOrigin(url); - } - else if (crossorigin !== false) - { - element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; - } - }; - - /** - * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.GLTexture} glTexture - * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) - * @returns {boolean} true is success - */ - BaseImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture, source) - { - var gl = renderer.gl; - var width = baseTexture.realWidth; - var height = baseTexture.realHeight; - - source = source || this.source; - - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - - if (!this.noSubImage - && baseTexture.target === gl.TEXTURE_2D - && glTexture.width === width - && glTexture.height === height) - { - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source); - } - else - { - glTexture.width = width; - glTexture.height = height; - - gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source); - } - - return true; - }; - - /** - * Checks if source width/height was changed, resize can cause extra baseTexture update. - * Triggers one update in any case. - */ - BaseImageResource.prototype.update = function update () - { - if (this.destroyed) - { - return; - } - - var width = this.source.naturalWidth || this.source.videoWidth || this.source.width; - var height = this.source.naturalHeight || this.source.videoHeight || this.source.height; - - this.resize(width, height); - - Resource.prototype.update.call(this); - }; - - /** - * Destroy this BaseImageResource - * @override - * @param {PIXI.BaseTexture} [fromTexture] Optional base texture - * @return {boolean} Destroy was successful - */ - BaseImageResource.prototype.dispose = function dispose () - { - this.source = null; - }; - - return BaseImageResource; - }(Resource)); - - /** - * Resource type for HTMLImageElement. - * @class - * @extends PIXI.resources.BaseImageResource - * @memberof PIXI.resources - */ - var ImageResource = /*@__PURE__*/(function (BaseImageResource) { - function ImageResource(source, options) - { - options = options || {}; - - if (!(source instanceof HTMLImageElement)) - { - var imageElement = new Image(); - - BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); - - imageElement.src = source; - source = imageElement; - } - - BaseImageResource.call(this, source); - - // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height - // to non-zero values before its loading completes if images are in a cache. - // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. - // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). - if (!source.complete && !!this._width && !!this._height) - { - this._width = 0; - this._height = 0; - } - - /** - * URL of the image source - * @member {string} - */ - this.url = source.src; - - /** - * When process is completed - * @member {Promise} - * @private - */ - this._process = null; - - /** - * If the image should be disposed after upload - * @member {boolean} - * @default false - */ - this.preserveBitmap = false; - - /** - * If capable, convert the image using createImageBitmap API - * @member {boolean} - * @default PIXI.settings.CREATE_IMAGE_BITMAP - */ - this.createBitmap = (options.createBitmap !== undefined - ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap; - - /** - * Controls texture alphaMode field - * Copies from options - * Default is `null`, copies option from baseTexture - * - * @member {PIXI.ALPHA_MODES|null} - * @readonly - */ - this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; - - if (options.premultiplyAlpha !== undefined) - { - // triggers deprecation - this.premultiplyAlpha = options.premultiplyAlpha; - } - - /** - * The ImageBitmap element created for HTMLImageElement - * @member {ImageBitmap} - * @default null - */ - this.bitmap = null; - - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - this._load = null; - - if (options.autoLoad !== false) - { - this.load(); - } - } - - if ( BaseImageResource ) { ImageResource.__proto__ = BaseImageResource; } - ImageResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype ); - ImageResource.prototype.constructor = ImageResource; - - /** - * returns a promise when image will be loaded and processed - * - * @param {boolean} [createBitmap=true] whether process image into bitmap - * @returns {Promise} - */ - ImageResource.prototype.load = function load (createBitmap) - { - var this$1 = this; - - if (createBitmap !== undefined) - { - this.createBitmap = createBitmap; - } - - if (this._load) - { - return this._load; - } - - this._load = new Promise(function (resolve) { - this$1.url = this$1.source.src; - var ref = this$1; - var source = ref.source; - - var completed = function () { - if (this$1.destroyed) - { - return; - } - source.onload = null; - source.onerror = null; - - this$1.resize(source.width, source.height); - this$1._load = null; - - if (this$1.createBitmap) - { - resolve(this$1.process()); - } - else - { - resolve(this$1); - } - }; - - if (source.complete && source.src) - { - completed(); - } - else - { - source.onload = completed; - source.onerror = function (event) { return this$1.onError.run(event); }; - } - }); - - return this._load; - }; - - /** - * Called when we need to convert image into BitmapImage. - * Can be called multiple times, real promise is cached inside. - * - * @returns {Promise} cached promise to fill that bitmap - */ - ImageResource.prototype.process = function process () - { - var this$1 = this; - - if (this._process !== null) - { - return this._process; - } - if (this.bitmap !== null || !window.createImageBitmap) - { - return Promise.resolve(this); - } - - this._process = window.createImageBitmap(this.source, - 0, 0, this.source.width, this.source.height, - { - premultiplyAlpha: this.premultiplyAlpha === exports.ALPHA_MODES.UNPACK ? 'premultiply' : 'none', - }) - .then(function (bitmap) { - if (this$1.destroyed) - { - return Promise.reject(); - } - this$1.bitmap = bitmap; - this$1.update(); - this$1._process = null; - - return Promise.resolve(this$1); - }); - - return this._process; - }; - - /** - * Upload the image resource to GPU. - * - * @param {PIXI.Renderer} renderer - Renderer to upload to - * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource - * @param {PIXI.GLTexture} glTexture - GLTexture to use - * @returns {boolean} true is success - */ - ImageResource.prototype.upload = function upload (renderer, baseTexture, glTexture) - { - if (typeof this.alphaMode === 'number') - { - // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it - - baseTexture.alphaMode = this.alphaMode; - } - - if (!this.createBitmap) - { - return BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture); - } - if (!this.bitmap) - { - // yeah, ignore the output - this.process(); - if (!this.bitmap) - { - return false; - } - } - - BaseImageResource.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); - - if (!this.preserveBitmap) - { - // checks if there are other renderers that possibly need this bitmap - - var flag = true; - - for (var key in baseTexture._glTextures) - { - var otherTex = baseTexture._glTextures[key]; - - if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) - { - flag = false; - break; - } - } - - if (flag) - { - if (this.bitmap.close) - { - this.bitmap.close(); - } - - this.bitmap = null; - } - } - - return true; - }; - - /** - * Destroys this texture - * @override - */ - ImageResource.prototype.dispose = function dispose () - { - this.source.onload = null; - this.source.onerror = null; - - BaseImageResource.prototype.dispose.call(this); - - if (this.bitmap) - { - this.bitmap.close(); - this.bitmap = null; - } - this._process = null; - this._load = null; - }; - - return ImageResource; - }(BaseImageResource)); + settings.STRICT_TEXTURE_CACHE = false; /** * Collection of installed resource types, class must extend {@link PIXI.resources.Resource}. @@ -17954,7 +16619,6 @@ var PIXI = (function (exports) { * @readonly */ var INSTALLED = []; - /** * Create a resource element from a single source element. This * auto-detects which type of resource to create. All resources that @@ -17984,135 +16648,325 @@ var PIXI = (function (exports) { * texture should be updated from the video. Leave at 0 to update at every render * @return {PIXI.resources.Resource} The created resource. */ - function autoDetectResource(source, options) - { - if (!source) - { + function autoDetectResource(source, options) { + if (!source) { return null; } - var extension = ''; - - if (typeof source === 'string') - { + if (typeof source === 'string') { // search for file extension: period, 3-4 chars, then ?, # or EOL var result = (/\.(\w{3,4})(?:$|\?|#)/i).exec(source); - - if (result) - { + if (result) { extension = result[1].toLowerCase(); } } - - for (var i = INSTALLED.length - 1; i >= 0; --i) - { + for (var i = INSTALLED.length - 1; i >= 0; --i) { var ResourcePlugin = INSTALLED[i]; - - if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) - { + if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) { return new ResourcePlugin(source, options); } } - - // When in doubt: probably an image - // might be appropriate to throw an error or return null - return new ImageResource(source, options); + throw new Error('Unrecognized source type to auto-detect Resource'); } + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$2 = function(d, b) { + extendStatics$2 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$2(d, b); + }; + + function __extends$2(d, b) { + extendStatics$2(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Base resource class for textures that manages validation and uploading, depending on its type. + * + * Uploading of a base texture to the GPU is required. + * + * @class + * @memberof PIXI.resources + */ + var Resource = /** @class */ (function () { + /** + * @param {number} [width=0] - Width of the resource + * @param {number} [height=0] - Height of the resource + */ + function Resource(width, height) { + if (width === void 0) { width = 0; } + if (height === void 0) { height = 0; } + /** + * Internal width of the resource + * @member {number} + * @protected + */ + this._width = width; + /** + * Internal height of the resource + * @member {number} + * @protected + */ + this._height = height; + /** + * If resource has been destroyed + * @member {boolean} + * @readonly + * @default false + */ + this.destroyed = false; + /** + * `true` if resource is created by BaseTexture + * useful for doing cleanup with BaseTexture destroy + * and not cleaning up resources that were created + * externally. + * @member {boolean} + * @protected + */ + this.internal = false; + /** + * Mini-runner for handling resize events + * accepts 2 parameters: width, height + * + * @member {Runner} + * @private + */ + this.onResize = new Runner('setRealSize'); + /** + * Mini-runner for handling update events + * + * @member {Runner} + * @private + */ + this.onUpdate = new Runner('update'); + /** + * Handle internal errors, such as loading errors + * accepts 1 param: error + * + * @member {Runner} + * @private + */ + this.onError = new Runner('onError'); + } + /** + * Bind to a parent BaseTexture + * + * @param {PIXI.BaseTexture} baseTexture - Parent texture + */ + Resource.prototype.bind = function (baseTexture) { + this.onResize.add(baseTexture); + this.onUpdate.add(baseTexture); + this.onError.add(baseTexture); + // Call a resize immediate if we already + // have the width and height of the resource + if (this._width || this._height) { + this.onResize.emit(this._width, this._height); + } + }; + /** + * Unbind to a parent BaseTexture + * + * @param {PIXI.BaseTexture} baseTexture - Parent texture + */ + Resource.prototype.unbind = function (baseTexture) { + this.onResize.remove(baseTexture); + this.onUpdate.remove(baseTexture); + this.onError.remove(baseTexture); + }; + /** + * Trigger a resize event + * @param {number} width - X dimension + * @param {number} height - Y dimension + */ + Resource.prototype.resize = function (width, height) { + if (width !== this._width || height !== this._height) { + this._width = width; + this._height = height; + this.onResize.emit(width, height); + } + }; + Object.defineProperty(Resource.prototype, "valid", { + /** + * Has been validated + * @readonly + * @member {boolean} + */ + get: function () { + return !!this._width && !!this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Has been updated trigger event + */ + Resource.prototype.update = function () { + if (!this.destroyed) { + this.onUpdate.emit(); + } + }; + /** + * This can be overridden to start preloading a resource + * or do any other prepare step. + * @protected + * @return {Promise} Handle the validate event + */ + Resource.prototype.load = function () { + return Promise.resolve(this); + }; + Object.defineProperty(Resource.prototype, "width", { + /** + * The width of the resource. + * + * @member {number} + * @readonly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Resource.prototype, "height", { + /** + * The height of the resource. + * + * @member {number} + * @readonly + */ + get: function () { + return this._height; + }, + enumerable: false, + configurable: true + }); + /** + * Set the style, optional to override + * + * @param {PIXI.Renderer} renderer - yeah, renderer! + * @param {PIXI.BaseTexture} baseTexture - the texture + * @param {PIXI.GLTexture} glTexture - texture instance for this webgl context + * @returns {boolean} `true` is success + */ + Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) { + return false; + }; + /** + * Clean up anything, this happens when destroying is ready. + * + * @protected + */ + Resource.prototype.dispose = function () { + // override + }; + /** + * Call when destroying resource, unbind any BaseTexture object + * before calling this method, as reference counts are maintained + * internally. + */ + Resource.prototype.destroy = function () { + if (!this.destroyed) { + this.destroyed = true; + this.dispose(); + this.onError.removeAll(); + this.onError = null; + this.onResize.removeAll(); + this.onResize = null; + this.onUpdate.removeAll(); + this.onUpdate = null; + } + }; + /** + * Abstract, used to auto-detect resource type + * + * @static + * @param {*} source - The source object + * @param {string} extension - The extension of source, if set + */ + Resource.test = function (_source, _extension) { + return false; + }; + return Resource; + }()); + /** * @interface SharedArrayBuffer */ - /** * Buffer resource with data of typed array. * @class * @extends PIXI.resources.Resource * @memberof PIXI.resources */ - var BufferResource = /*@__PURE__*/(function (Resource) { - function BufferResource(source, options) - { - var ref = options || {}; - var width = ref.width; - var height = ref.height; - - if (!width || !height) - { + var BufferResource = /** @class */ (function (_super) { + __extends$2(BufferResource, _super); + /** + * @param {Float32Array|Uint8Array|Uint32Array} source - Source buffer + * @param {object} options - Options + * @param {number} options.width - Width of the texture + * @param {number} options.height - Height of the texture + */ + function BufferResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + if (!width || !height) { throw new Error('BufferResource width or height invalid'); } - - Resource.call(this, width, height); - + _this = _super.call(this, width, height) || this; /** * Source array * Cannot be ClampedUint8Array because it cant be uploaded to WebGL * * @member {Float32Array|Uint8Array|Uint32Array} */ - this.data = source; + _this.data = source; + return _this; } - - if ( Resource ) { BufferResource.__proto__ = Resource; } - BufferResource.prototype = Object.create( Resource && Resource.prototype ); - BufferResource.prototype.constructor = BufferResource; - /** * Upload the texture to the GPU. - * @param {PIXI.Renderer} renderer Upload to the renderer - * @param {PIXI.BaseTexture} baseTexture Reference to parent texture - * @param {PIXI.GLTexture} glTexture glTexture + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture - glTexture * @returns {boolean} true is success */ - BufferResource.prototype.upload = function upload (renderer, baseTexture, glTexture) - { + BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) { var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) - { - gl.texSubImage2D( - baseTexture.target, - 0, - 0, - 0, - baseTexture.width, - baseTexture.height, - baseTexture.format, - baseTexture.type, - this.data - ); + if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); } - else - { + else { glTexture.width = baseTexture.width; glTexture.height = baseTexture.height; - - gl.texImage2D( - baseTexture.target, - 0, - glTexture.internalFormat, - baseTexture.width, - baseTexture.height, - 0, - baseTexture.format, - glTexture.type, - this.data - ); + gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.width, baseTexture.height, 0, baseTexture.format, glTexture.type, this.data); } - return true; }; - /** * Destroy and don't use after this * @override */ - BufferResource.prototype.dispose = function dispose () - { + BufferResource.prototype.dispose = function () { this.data = null; }; - /** * Used to auto-detect the type of resource. * @@ -18120,13 +16974,11 @@ var PIXI = (function (exports) { * @param {*} source - The source object * @return {boolean} `true` if */ - BufferResource.test = function test (source) - { + BufferResource.test = function (source) { return source instanceof Float32Array || source instanceof Uint8Array || source instanceof Uint32Array; }; - return BufferResource; }(Resource)); @@ -18135,7 +16987,6 @@ var PIXI = (function (exports) { format: exports.FORMATS.RGBA, alphaMode: exports.ALPHA_MODES.NPM, }; - /** * A Texture stores the information that represents an image. * All textures have a base texture, which contains information about the source. @@ -18162,144 +17013,112 @@ var PIXI = (function (exports) { * @param {object} [options.resourceOptions] - Optional resource options, * see {@link PIXI.resources.autoDetectResource autoDetectResource} */ - var BaseTexture = /*@__PURE__*/(function (EventEmitter) { - function BaseTexture(resource, options) - { - if ( resource === void 0 ) { resource = null; } - if ( options === void 0 ) { options = null; } - - EventEmitter.call(this); - + var BaseTexture = /** @class */ (function (_super) { + __extends$2(BaseTexture, _super); + function BaseTexture(resource, options) { + if (resource === void 0) { resource = null; } + if (options === void 0) { options = null; } + var _this = _super.call(this) || this; options = options || {}; - - var alphaMode = options.alphaMode; - var mipmap = options.mipmap; - var anisotropicLevel = options.anisotropicLevel; - var scaleMode = options.scaleMode; - var width = options.width; - var height = options.height; - var wrapMode = options.wrapMode; - var format = options.format; - var type = options.type; - var target = options.target; - var resolution = options.resolution; - var resourceOptions = options.resourceOptions; - + var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions; // Convert the resource to a Resource object - if (resource && !(resource instanceof Resource)) - { + if (resource && !(resource instanceof Resource)) { resource = autoDetectResource(resource, resourceOptions); resource.internal = true; } - /** * The width of the base texture set when the image has loaded * * @readonly * @member {number} */ - this.width = width || 0; - + _this.width = width || 0; /** * The height of the base texture set when the image has loaded * * @readonly * @member {number} */ - this.height = height || 0; - + _this.height = height || 0; /** * The resolution / device pixel ratio of the texture * * @member {number} * @default PIXI.settings.RESOLUTION */ - this.resolution = resolution || settings.RESOLUTION; - + _this.resolution = resolution || settings.RESOLUTION; /** * Mipmap mode of the texture, affects downscaled images * * @member {PIXI.MIPMAP_MODES} * @default PIXI.settings.MIPMAP_TEXTURES */ - this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; - + _this.mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES; /** * Anisotropic filtering level of texture * * @member {number} * @default PIXI.settings.ANISOTROPIC_LEVEL */ - this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; - + _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL; /** * How the texture wraps * @member {number} */ - this.wrapMode = wrapMode || settings.WRAP_MODE; - + _this.wrapMode = wrapMode || settings.WRAP_MODE; /** * The scale mode to apply when scaling this texture * * @member {PIXI.SCALE_MODES} * @default PIXI.settings.SCALE_MODE */ - this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; - + _this.scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE; /** * The pixel format of the texture * * @member {PIXI.FORMATS} * @default PIXI.FORMATS.RGBA */ - this.format = format || exports.FORMATS.RGBA; - + _this.format = format || exports.FORMATS.RGBA; /** * The type of resource data * * @member {PIXI.TYPES} * @default PIXI.TYPES.UNSIGNED_BYTE */ - this.type = type || exports.TYPES.UNSIGNED_BYTE; - + _this.type = type || exports.TYPES.UNSIGNED_BYTE; /** * The target type * * @member {PIXI.TARGETS} * @default PIXI.TARGETS.TEXTURE_2D */ - this.target = target || exports.TARGETS.TEXTURE_2D; - + _this.target = target || exports.TARGETS.TEXTURE_2D; /** * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}. * * @member {PIXI.ALPHA_MODES} * @default PIXI.ALPHA_MODES.UNPACK */ - this.alphaMode = alphaMode !== undefined ? alphaMode : exports.ALPHA_MODES.UNPACK; - - if (options.premultiplyAlpha !== undefined) - { + _this.alphaMode = alphaMode !== undefined ? alphaMode : exports.ALPHA_MODES.UNPACK; + if (options.premultiplyAlpha !== undefined) { // triggers deprecation - this.premultiplyAlpha = options.premultiplyAlpha; + _this.premultiplyAlpha = options.premultiplyAlpha; } - /** * Global unique identifier for this BaseTexture * - * @member {string} + * @member {number} * @protected */ - this.uid = uid(); - + _this.uid = uid(); /** * Used by automatic texture Garbage Collection, stores last GC tick when it was bound * * @member {number} * @protected */ - this.touched = 0; - + _this.touched = 0; /** * Whether or not the texture is a power of two, try to use power of two textures as much * as you can @@ -18308,17 +17127,15 @@ var PIXI = (function (exports) { * @member {boolean} * @default false */ - this.isPowerOfTwo = false; - this._refreshPOT(); - + _this.isPowerOfTwo = false; + _this._refreshPOT(); /** * The map of render context textures where this is bound * * @member {Object} * @private */ - this._glTextures = {}; - + _this._glTextures = {}; /** * Used by TextureSystem to only update texture to the GPU when needed. * Please call `update()` to increment it. @@ -18326,30 +17143,26 @@ var PIXI = (function (exports) { * @readonly * @member {number} */ - this.dirtyId = 0; - + _this.dirtyId = 0; /** * Used by TextureSystem to only update texture style when needed. * * @protected * @member {number} */ - this.dirtyStyleId = 0; - + _this.dirtyStyleId = 0; /** * Currently default cache ID. * * @member {string} */ - this.cacheId = null; - + _this.cacheId = null; /** * Generally speaking means when resource is loaded. * @readonly * @member {boolean} */ - this.valid = width > 0 && height > 0; - + _this.valid = width > 0 && height > 0; /** * The collection of alternative cache ids, since some BaseTextures * can have more than one ID, short name and longer full URL @@ -18357,16 +17170,14 @@ var PIXI = (function (exports) { * @member {Array} * @readonly */ - this.textureCacheIds = []; - + _this.textureCacheIds = []; /** * Flag if BaseTexture has been destroyed. * * @member {boolean} * @readonly */ - this.destroyed = false; - + _this.destroyed = false; /** * The resource used by this BaseTexture, there can only * be one resource per BaseTexture, but textures can share @@ -18375,22 +17186,25 @@ var PIXI = (function (exports) { * @member {PIXI.resources.Resource} * @readonly */ - this.resource = null; - + _this.resource = null; /** * Number of the texture batch, used by multi-texture renderers * * @member {number} */ - this._batchEnabled = 0; - + _this._batchEnabled = 0; /** * Location inside texture batch, used by multi-texture renderers * * @member {number} */ - this._batchLocation = 0; - + _this._batchLocation = 0; + /** + * Whether its a part of another texture, handled by ArrayResource or CubeResource + * + * @member {PIXI.BaseTexture} + */ + _this.parentTextureArray = null; /** * Fired when a not-immediately-available source finishes loading. * @@ -18398,7 +17212,6 @@ var PIXI = (function (exports) { * @event PIXI.BaseTexture#loaded * @param {PIXI.BaseTexture} baseTexture - Resource loaded. */ - /** * Fired when a not-immediately-available source fails to load. * @@ -18407,7 +17220,6 @@ var PIXI = (function (exports) { * @param {PIXI.BaseTexture} baseTexture - Resource errored. * @param {ErrorEvent} event - Load error event. */ - /** * Fired when BaseTexture is updated. * @@ -18415,7 +17227,6 @@ var PIXI = (function (exports) { * @event PIXI.BaseTexture#loaded * @param {PIXI.BaseTexture} baseTexture - Resource loaded. */ - /** * Fired when BaseTexture is updated. * @@ -18423,7 +17234,6 @@ var PIXI = (function (exports) { * @event PIXI.BaseTexture#update * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated. */ - /** * Fired when BaseTexture is destroyed. * @@ -18431,39 +17241,36 @@ var PIXI = (function (exports) { * @event PIXI.BaseTexture#dispose * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed. */ - // Set the resource - this.setResource(resource); + _this.setResource(resource); + return _this; } - - if ( EventEmitter ) { BaseTexture.__proto__ = EventEmitter; } - BaseTexture.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - BaseTexture.prototype.constructor = BaseTexture; - - var prototypeAccessors = { realWidth: { configurable: true },realHeight: { configurable: true } }; - - /** - * Pixel width of the source of this texture - * - * @readonly - * @member {number} - */ - prototypeAccessors.realWidth.get = function () - { - return Math.ceil((this.width * this.resolution) - 1e-4); - }; - - /** - * Pixel height of the source of this texture - * - * @readonly - * @member {number} - */ - prototypeAccessors.realHeight.get = function () - { - return Math.ceil((this.height * this.resolution) - 1e-4); - }; - + Object.defineProperty(BaseTexture.prototype, "realWidth", { + /** + * Pixel width of the source of this texture + * + * @readonly + * @member {number} + */ + get: function () { + return Math.ceil((this.width * this.resolution) - 1e-4); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseTexture.prototype, "realHeight", { + /** + * Pixel height of the source of this texture + * + * @readonly + * @member {number} + */ + get: function () { + return Math.ceil((this.height * this.resolution) - 1e-4); + }, + enumerable: false, + configurable: true + }); /** * Changes style options of BaseTexture * @@ -18471,200 +17278,149 @@ var PIXI = (function (exports) { * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps * @returns {PIXI.BaseTexture} this */ - BaseTexture.prototype.setStyle = function setStyle (scaleMode, mipmap) - { + BaseTexture.prototype.setStyle = function (scaleMode, mipmap) { var dirty; - - if (scaleMode !== undefined && scaleMode !== this.scaleMode) - { + if (scaleMode !== undefined && scaleMode !== this.scaleMode) { this.scaleMode = scaleMode; dirty = true; } - - if (mipmap !== undefined && mipmap !== this.mipmap) - { + if (mipmap !== undefined && mipmap !== this.mipmap) { this.mipmap = mipmap; dirty = true; } - - if (dirty) - { + if (dirty) { this.dirtyStyleId++; } - return this; }; - /** * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero. * - * @param {number} width Visual width - * @param {number} height Visual height - * @param {number} [resolution] Optionally set resolution + * @param {number} width - Visual width + * @param {number} height - Visual height + * @param {number} [resolution] - Optionally set resolution * @returns {PIXI.BaseTexture} this */ - BaseTexture.prototype.setSize = function setSize (width, height, resolution) - { + BaseTexture.prototype.setSize = function (width, height, resolution) { this.resolution = resolution || this.resolution; this.width = width; this.height = height; this._refreshPOT(); this.update(); - return this; }; - /** * Sets real size of baseTexture, preserves current resolution. * - * @param {number} realWidth Full rendered width - * @param {number} realHeight Full rendered height - * @param {number} [resolution] Optionally set resolution + * @param {number} realWidth - Full rendered width + * @param {number} realHeight - Full rendered height + * @param {number} [resolution] - Optionally set resolution * @returns {PIXI.BaseTexture} this */ - BaseTexture.prototype.setRealSize = function setRealSize (realWidth, realHeight, resolution) - { + BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) { this.resolution = resolution || this.resolution; this.width = realWidth / this.resolution; this.height = realHeight / this.resolution; this._refreshPOT(); this.update(); - return this; }; - /** * Refresh check for isPowerOfTwo texture based on size * * @private */ - BaseTexture.prototype._refreshPOT = function _refreshPOT () - { + BaseTexture.prototype._refreshPOT = function () { this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight); }; - /** * Changes resolution * - * @param {number} [resolution] res + * @param {number} resolution - res * @returns {PIXI.BaseTexture} this */ - BaseTexture.prototype.setResolution = function setResolution (resolution) - { + BaseTexture.prototype.setResolution = function (resolution) { var oldResolution = this.resolution; - - if (oldResolution === resolution) - { + if (oldResolution === resolution) { return this; } - this.resolution = resolution; - - if (this.valid) - { + if (this.valid) { this.width = this.width * oldResolution / resolution; this.height = this.height * oldResolution / resolution; this.emit('update', this); } - this._refreshPOT(); - return this; }; - /** * Sets the resource if it wasn't set. Throws error if resource already present * * @param {PIXI.resources.Resource} resource - that is managing this BaseTexture * @returns {PIXI.BaseTexture} this */ - BaseTexture.prototype.setResource = function setResource (resource) - { - if (this.resource === resource) - { + BaseTexture.prototype.setResource = function (resource) { + if (this.resource === resource) { return this; } - - if (this.resource) - { + if (this.resource) { throw new Error('Resource can be set only once'); } - resource.bind(this); - this.resource = resource; - return this; }; - /** * Invalidates the object. Texture becomes valid if width and height are greater than zero. */ - BaseTexture.prototype.update = function update () - { - if (!this.valid) - { - if (this.width > 0 && this.height > 0) - { + BaseTexture.prototype.update = function () { + if (!this.valid) { + if (this.width > 0 && this.height > 0) { this.valid = true; this.emit('loaded', this); this.emit('update', this); } } - else - { + else { this.dirtyId++; this.dirtyStyleId++; this.emit('update', this); } }; - /** * Handle errors with resources. * @private * @param {ErrorEvent} event - Error event emitted. */ - BaseTexture.prototype.onError = function onError (event) - { + BaseTexture.prototype.onError = function (event) { this.emit('error', this, event); }; - /** * Destroys this base texture. * The method stops if resource doesn't want this texture to be destroyed. * Removes texture from all caches. */ - BaseTexture.prototype.destroy = function destroy () - { + BaseTexture.prototype.destroy = function () { // remove and destroy the resource - if (this.resource) - { + if (this.resource) { this.resource.unbind(this); // only destroy resourced created internally - if (this.resource.internal) - { + if (this.resource.internal) { this.resource.destroy(); } this.resource = null; } - - if (this.cacheId) - { + if (this.cacheId) { delete BaseTextureCache[this.cacheId]; delete TextureCache[this.cacheId]; - this.cacheId = null; } - // finally let the WebGL renderer know.. this.dispose(); - BaseTexture.removeFromCache(this); this.textureCacheIds = null; - this.destroyed = true; }; - /** * Frees the texture from WebGL memory without destroying this texture object. * This means you can still use the texture later which will upload it to GPU @@ -18672,11 +17428,15 @@ var PIXI = (function (exports) { * * @fires PIXI.BaseTexture#dispose */ - BaseTexture.prototype.dispose = function dispose () - { + BaseTexture.prototype.dispose = function () { this.emit('dispose', this); }; - + /** + * Utility function for BaseTexture|Texture cast + */ + BaseTexture.prototype.castToBaseTexture = function () { + return this; + }; /** * Helper function that creates a base texture based on the source you provide. * The source can be - image url, image element, canvas element. If the @@ -18687,69 +17447,51 @@ var PIXI = (function (exports) { * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The * source to create base texture from. * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. * @returns {PIXI.BaseTexture} The new base texture. */ - BaseTexture.from = function from (source, options, strict) - { - if ( strict === void 0 ) { strict = settings.STRICT_TEXTURE_CACHE; } - + BaseTexture.from = function (source, options, strict) { + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } var isFrame = typeof source === 'string'; var cacheId = null; - - if (isFrame) - { + if (isFrame) { cacheId = source; } - else - { - if (!source._pixiId) - { - source._pixiId = "pixiid_" + (uid()); + else { + if (!source._pixiId) { + source._pixiId = "pixiid_" + uid(); } - cacheId = source._pixiId; } - var baseTexture = BaseTextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !baseTexture) - { - throw new Error(("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache.")); + if (isFrame && strict && !baseTexture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in BaseTextureCache."); } - - if (!baseTexture) - { + if (!baseTexture) { baseTexture = new BaseTexture(source, options); baseTexture.cacheId = cacheId; BaseTexture.addToCache(baseTexture, cacheId); } - return baseTexture; }; - /** * Create a new BaseTexture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. * @return {PIXI.BaseTexture} The resulting new BaseTexture */ - BaseTexture.fromBuffer = function fromBuffer (buffer, width, height, options) - { + BaseTexture.fromBuffer = function (buffer, width, height, options) { buffer = buffer || new Float32Array(width * height * 4); - var resource = new BufferResource(buffer, { width: width, height: height }); var type = buffer instanceof Float32Array ? exports.TYPES.FLOAT : exports.TYPES.UNSIGNED_BYTE; - return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type })); }; - /** * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object. * @@ -18757,25 +17499,18 @@ var PIXI = (function (exports) { * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache. * @param {string} id - The id that the BaseTexture will be stored against. */ - BaseTexture.addToCache = function addToCache (baseTexture, id) - { - if (id) - { - if (baseTexture.textureCacheIds.indexOf(id) === -1) - { + BaseTexture.addToCache = function (baseTexture, id) { + if (id) { + if (baseTexture.textureCacheIds.indexOf(id) === -1) { baseTexture.textureCacheIds.push(id); } - - if (BaseTextureCache[id]) - { + if (BaseTextureCache[id]) { // eslint-disable-next-line no-console - console.warn(("BaseTexture added to the cache with an id [" + id + "] that already had an entry")); + console.warn("BaseTexture added to the cache with an id [" + id + "] that already had an entry"); } - BaseTextureCache[id] = baseTexture; } }; - /** * Remove a BaseTexture from the global BaseTextureCache. * @@ -18783,53 +17518,199 @@ var PIXI = (function (exports) { * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself. * @return {PIXI.BaseTexture|null} The BaseTexture that was removed. */ - BaseTexture.removeFromCache = function removeFromCache (baseTexture) - { - if (typeof baseTexture === 'string') - { + BaseTexture.removeFromCache = function (baseTexture) { + if (typeof baseTexture === 'string') { var baseTextureFromCache = BaseTextureCache[baseTexture]; - - if (baseTextureFromCache) - { + if (baseTextureFromCache) { var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture); - - if (index > -1) - { + if (index > -1) { baseTextureFromCache.textureCacheIds.splice(index, 1); } - delete BaseTextureCache[baseTexture]; - return baseTextureFromCache; } } - else if (baseTexture && baseTexture.textureCacheIds) - { - for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) - { + else if (baseTexture && baseTexture.textureCacheIds) { + for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) { delete BaseTextureCache[baseTexture.textureCacheIds[i]]; } - baseTexture.textureCacheIds.length = 0; - return baseTexture; } - return null; }; - - Object.defineProperties( BaseTexture.prototype, prototypeAccessors ); - + /** + * Global number of the texture batch, used by multi-texture renderers + * + * @static + * @member {number} + */ + BaseTexture._globalBatch = 0; return BaseTexture; }(eventemitter3)); /** - * Global number of the texture batch, used by multi-texture renderers + * Resource that can manage several resource (items) inside. + * All resources need to have the same pixel size. + * Parent class for CubeResource and ArrayResource * - * @static - * @member {number} + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + * @param {object} [options] Options to for Resource constructor + * @param {number} [options.width] - Width of the resource + * @param {number} [options.height] - Height of the resource */ - BaseTexture._globalBatch = 0; + var AbstractMultiResource = /** @class */ (function (_super) { + __extends$2(AbstractMultiResource, _super); + function AbstractMultiResource(length, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; + _this = _super.call(this, width, height) || this; + /** + * Collection of partial baseTextures that correspond to resources + * @member {Array} + * @readonly + */ + _this.items = []; + /** + * Dirty IDs for each part + * @member {Array} + * @readonly + */ + _this.itemDirtyIds = []; + for (var i = 0; i < length; i++) { + var partTexture = new BaseTexture(); + _this.items.push(partTexture); + // -2 - first run of texture array upload + // -1 - texture item was allocated + // >=0 - texture item uploaded , in sync with items[i].dirtyId + _this.itemDirtyIds.push(-2); + } + /** + * Number of elements in array + * + * @member {number} + * @readonly + */ + _this.length = length; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + /** + * Bound baseTexture, there can only be one + * @member {PIXI.BaseTexture} + */ + _this.baseTexture = null; + return _this; + } + /** + * used from ArrayResource and CubeResource constructors + * @param {Array<*>} resources - Can be resources, image elements, canvas, etc. , + * length should be same as constructor length + * @param {object} [options] - detect options for resources + * @protected + */ + AbstractMultiResource.prototype.initFromArray = function (resources, options) { + for (var i = 0; i < this.length; i++) { + if (!resources[i]) { + continue; + } + if (resources[i].castToBaseTexture) { + this.addBaseTextureAt(resources[i].castToBaseTexture(), i); + } + else if (resources[i] instanceof Resource) { + this.addResourceAt(resources[i], i); + } + else { + this.addResourceAt(autoDetectResource(resources[i], options), i); + } + } + }; + /** + * Destroy this BaseImageResource + * @override + */ + AbstractMultiResource.prototype.dispose = function () { + for (var i = 0, len = this.length; i < len; i++) { + this.items[i].destroy(); + } + this.items = null; + this.itemDirtyIds = null; + this._load = null; + }; + /** + * Set a resource by ID + * + * @param {PIXI.resources.Resource} resource + * @param {number} index - Zero-based index of resource to set + * @return {PIXI.resources.ArrayResource} Instance for chaining + */ + AbstractMultiResource.prototype.addResourceAt = function (resource, index) { + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + // Inherit the first resource dimensions + if (resource.valid && !this.valid) { + this.resize(resource.width, resource.height); + } + this.items[index].setResource(resource); + return this; + }; + /** + * Set the parent base texture + * @member {PIXI.BaseTexture} + * @override + */ + AbstractMultiResource.prototype.bind = function (baseTexture) { + if (this.baseTexture !== null) { + throw new Error('Only one base texture per TextureArray is allowed'); + } + _super.prototype.bind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = baseTexture; + this.items[i].on('update', baseTexture.update, baseTexture); + } + }; + /** + * Unset the parent base texture + * @member {PIXI.BaseTexture} + * @override + */ + AbstractMultiResource.prototype.unbind = function (baseTexture) { + _super.prototype.unbind.call(this, baseTexture); + for (var i = 0; i < this.length; i++) { + this.items[i].parentTextureArray = null; + this.items[i].off('update', baseTexture.update, baseTexture); + } + }; + /** + * Load all the resources simultaneously + * @override + * @return {Promise} When load is resolved + */ + AbstractMultiResource.prototype.load = function () { + var _this = this; + if (this._load) { + return this._load; + } + var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; }); + // TODO: also implement load part-by-part strategy + var promises = resources.map(function (item) { return item.load(); }); + this._load = Promise.all(promises) + .then(function () { + var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight; + _this.resize(realWidth, realHeight); + return Promise.resolve(_this); + }); + return this._load; + }; + return AbstractMultiResource; + }(Resource)); /** * A resource that contains a number of sources. @@ -18839,185 +17720,56 @@ var PIXI = (function (exports) { * @memberof PIXI.resources * @param {number|Array<*>} source - Number of items in array or the collection * of image URLs to use. Can also be resources, image elements, canvas, etc. - * @param {object} [options] Options to apply to {@link PIXI.resources.autoDetectResource} + * @param {object} [options] - Options to apply to {@link PIXI.resources.autoDetectResource} * @param {number} [options.width] - Width of the resource * @param {number} [options.height] - Height of the resource */ - var ArrayResource = /*@__PURE__*/(function (Resource) { - function ArrayResource(source, options) - { - options = options || {}; - + var ArrayResource = /** @class */ (function (_super) { + __extends$2(ArrayResource, _super); + function ArrayResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height; var urls; - var length = source; - - if (Array.isArray(source)) - { + var length; + if (Array.isArray(source)) { urls = source; length = source.length; } - - Resource.call(this, options.width, options.height); - - /** - * Collection of resources. - * @member {Array} - * @readonly - */ - this.items = []; - - /** - * Dirty IDs for each part - * @member {Array} - * @readonly - */ - this.itemDirtyIds = []; - - for (var i = 0; i < length; i++) - { - var partTexture = new BaseTexture(); - - this.items.push(partTexture); - this.itemDirtyIds.push(-1); + else { + length = source; } - - /** - * Number of elements in array - * - * @member {number} - * @readonly - */ - this.length = length; - - /** - * Promise when loading - * @member {Promise} - * @private - * @default null - */ - this._load = null; - - if (urls) - { - for (var i$1 = 0; i$1 < length; i$1++) - { - this.addResourceAt(autoDetectResource(urls[i$1], options), i$1); - } + _this = _super.call(this, length, { width: width, height: height }) || this; + if (urls) { + _this.initFromArray(urls, options); } + return _this; } - - if ( Resource ) { ArrayResource.__proto__ = Resource; } - ArrayResource.prototype = Object.create( Resource && Resource.prototype ); - ArrayResource.prototype.constructor = ArrayResource; - /** - * Destroy this BaseImageResource - * @override - */ - ArrayResource.prototype.dispose = function dispose () - { - for (var i = 0, len = this.length; i < len; i++) - { - this.items[i].destroy(); - } - this.items = null; - this.itemDirtyIds = null; - this._load = null; - }; - - /** - * Set a resource by ID + * Set a baseTexture by ID, + * ArrayResource just takes resource from it, nothing more * - * @param {PIXI.resources.Resource} resource + * @param {PIXI.BaseTexture} baseTexture * @param {number} index - Zero-based index of resource to set * @return {PIXI.resources.ArrayResource} Instance for chaining */ - ArrayResource.prototype.addResourceAt = function addResourceAt (resource, index) - { - var baseTexture = this.items[index]; - - if (!baseTexture) - { - throw new Error(("Index " + index + " is out of bounds")); + ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) { + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); } - - // Inherit the first resource dimensions - if (resource.valid && !this.valid) - { - this.resize(resource.width, resource.height); + else { + throw new Error('ArrayResource does not support RenderTexture'); } - - this.items[index].setResource(resource); - return this; }; - /** - * Set the parent base texture + * Add binding * @member {PIXI.BaseTexture} * @override */ - ArrayResource.prototype.bind = function bind (baseTexture) - { - Resource.prototype.bind.call(this, baseTexture); - + ArrayResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); baseTexture.target = exports.TARGETS.TEXTURE_2D_ARRAY; - - for (var i = 0; i < this.length; i++) - { - this.items[i].on('update', baseTexture.update, baseTexture); - } }; - - /** - * Unset the parent base texture - * @member {PIXI.BaseTexture} - * @override - */ - ArrayResource.prototype.unbind = function unbind (baseTexture) - { - Resource.prototype.unbind.call(this, baseTexture); - - for (var i = 0; i < this.length; i++) - { - this.items[i].off('update', baseTexture.update, baseTexture); - } - }; - - /** - * Load all the resources simultaneously - * @override - * @return {Promise} When load is resolved - */ - ArrayResource.prototype.load = function load () - { - var this$1 = this; - - if (this._load) - { - return this._load; - } - - var resources = this.items.map(function (item) { return item.resource; }); - - // TODO: also implement load part-by-part strategy - var promises = resources.map(function (item) { return item.load(); }); - - this._load = Promise.all(promises) - .then(function () { - var ref = resources[0]; - var width = ref.width; - var height = ref.height; - - this$1.resize(width, height); - - return Promise.resolve(this$1); - } - ); - - return this._load; - }; - /** * Upload the resources to the GPU. * @param {PIXI.Renderer} renderer @@ -19025,66 +17777,131 @@ var PIXI = (function (exports) { * @param {PIXI.GLTexture} glTexture * @returns {boolean} whether texture was uploaded */ - ArrayResource.prototype.upload = function upload (renderer, texture, glTexture) - { - var ref = this; - var length = ref.length; - var itemDirtyIds = ref.itemDirtyIds; - var items = ref.items; + ArrayResource.prototype.upload = function (renderer, texture, glTexture) { + var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items; var gl = renderer.gl; - - if (glTexture.dirtyId < 0) - { - gl.texImage3D( - gl.TEXTURE_2D_ARRAY, - 0, - texture.format, - this._width, - this._height, - length, - 0, - texture.format, - texture.type, - null - ); + if (glTexture.dirtyId < 0) { + gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, texture.format, this._width, this._height, length, 0, texture.format, texture.type, null); } - - for (var i = 0; i < length; i++) - { + for (var i = 0; i < length; i++) { var item = items[i]; - - if (itemDirtyIds[i] < item.dirtyId) - { + if (itemDirtyIds[i] < item.dirtyId) { itemDirtyIds[i] = item.dirtyId; - if (item.valid) - { - gl.texSubImage3D( - gl.TEXTURE_2D_ARRAY, - 0, - 0, // xoffset - 0, // yoffset - i, // zoffset - item.resource.width, - item.resource.height, - 1, - texture.format, - texture.type, - item.resource.source - ); + if (item.valid) { + gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset + 0, // yoffset + i, // zoffset + item.resource.width, item.resource.height, 1, texture.format, texture.type, item.resource.source); } } } - return true; }; - return ArrayResource; + }(AbstractMultiResource)); + + /** + * Base for all the image/canvas resources + * @class + * @extends PIXI.resources.Resource + * @memberof PIXI.resources + */ + var BaseImageResource = /** @class */ (function (_super) { + __extends$2(BaseImageResource, _super); + /** + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source + */ + function BaseImageResource(source) { + var _this = this; + var sourceAny = source; + var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width; + var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height; + _this = _super.call(this, width, height) || this; + /** + * The source element + * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} + * @readonly + */ + _this.source = source; + /** + * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading. + * Certain types of media (e.g. video) using `texImage2D` is more performant. + * @member {boolean} + * @default false + * @private + */ + _this.noSubImage = false; + return _this; + } + /** + * Set cross origin based detecting the url and the crossorigin + * @protected + * @param {HTMLElement} element - Element to apply crossOrigin + * @param {string} url - URL to check + * @param {boolean|string} [crossorigin=true] - Cross origin value to use + */ + BaseImageResource.crossOrigin = function (element, url, crossorigin) { + if (crossorigin === undefined && url.indexOf('data:') !== 0) { + element.crossOrigin = determineCrossOrigin(url); + } + else if (crossorigin !== false) { + element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous'; + } + }; + /** + * Upload the texture to the GPU. + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture + * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] (optional) + * @returns {boolean} true is success + */ + BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) { + var gl = renderer.gl; + var width = baseTexture.realWidth; + var height = baseTexture.realHeight; + source = source || this.source; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); + if (!this.noSubImage + && baseTexture.target === gl.TEXTURE_2D + && glTexture.width === width + && glTexture.height === height) { + gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, baseTexture.type, source); + } + else { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(baseTexture.target, 0, baseTexture.format, baseTexture.format, baseTexture.type, source); + } + return true; + }; + /** + * Checks if source width/height was changed, resize can cause extra baseTexture update. + * Triggers one update in any case. + */ + BaseImageResource.prototype.update = function () { + if (this.destroyed) { + return; + } + var source = this.source; + var width = source.naturalWidth || source.videoWidth || source.width; + var height = source.naturalHeight || source.videoHeight || source.height; + this.resize(width, height); + _super.prototype.update.call(this); + }; + /** + * Destroy this BaseImageResource + * @override + */ + BaseImageResource.prototype.dispose = function () { + this.source = null; + }; + return BaseImageResource; }(Resource)); /** * @interface OffscreenCanvas */ - /** * Resource type for HTMLCanvasElement. * @class @@ -19092,28 +17909,26 @@ var PIXI = (function (exports) { * @memberof PIXI.resources * @param {HTMLCanvasElement} source - Canvas element to use */ - var CanvasResource = /*@__PURE__*/(function (BaseImageResource) { - function CanvasResource () { - BaseImageResource.apply(this, arguments); + var CanvasResource = /** @class */ (function (_super) { + __extends$2(CanvasResource, _super); + function CanvasResource() { + return _super !== null && _super.apply(this, arguments) || this; } - - if ( BaseImageResource ) { CanvasResource.__proto__ = BaseImageResource; } - CanvasResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype ); - CanvasResource.prototype.constructor = CanvasResource; - - CanvasResource.test = function test (source) - { + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {HTMLCanvasElement|OffscreenCanvas} source - The source object + * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas + */ + CanvasResource.test = function (source) { var OffscreenCanvas = window.OffscreenCanvas; - // Check for browsers that don't yet support OffscreenCanvas - if (OffscreenCanvas && source instanceof OffscreenCanvas) - { + if (OffscreenCanvas && source instanceof OffscreenCanvas) { return true; } - return source instanceof HTMLCanvasElement; }; - return CanvasResource; }(BaseImageResource)); @@ -19123,90 +17938,363 @@ var PIXI = (function (exports) { * @class * @extends PIXI.resources.ArrayResource * @memberof PIXI.resources - * @param {Array} [source] Collection of URLs or resources + * @param {Array} [source] - Collection of URLs or resources * to use as the sides of the cube. * @param {object} [options] - ImageResource options * @param {number} [options.width] - Width of resource * @param {number} [options.height] - Height of resource + * @param {number} [options.autoLoad=true] - Whether to auto-load resources + * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied, + * whether to copy them or use */ - var CubeResource = /*@__PURE__*/(function (ArrayResource) { - function CubeResource(source, options) - { - options = options || {}; - - ArrayResource.call(this, source, options); - - if (this.length !== CubeResource.SIDES) - { - throw new Error(("Invalid length. Got " + (this.length) + ", expected 6")); + var CubeResource = /** @class */ (function (_super) { + __extends$2(CubeResource, _super); + function CubeResource(source, options) { + var _this = this; + var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture; + if (source && source.length !== CubeResource.SIDES) { + throw new Error("Invalid length. Got " + source.length + ", expected 6"); } - - for (var i = 0; i < CubeResource.SIDES; i++) - { - this.items[i].target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; + _this = _super.call(this, 6, { width: width, height: height }) || this; + for (var i = 0; i < CubeResource.SIDES; i++) { + _this.items[i].target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i; } - - if (options.autoLoad !== false) - { - this.load(); + /** + * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself + * @member {boolean} + * @protected + */ + _this.linkBaseTexture = linkBaseTexture !== false; + if (source) { + _this.initFromArray(source, options); } + if (autoLoad !== false) { + _this.load(); + } + return _this; } - - if ( ArrayResource ) { CubeResource.__proto__ = ArrayResource; } - CubeResource.prototype = Object.create( ArrayResource && ArrayResource.prototype ); - CubeResource.prototype.constructor = CubeResource; - /** * Add binding * * @override * @param {PIXI.BaseTexture} baseTexture - parent base texture */ - CubeResource.prototype.bind = function bind (baseTexture) - { - ArrayResource.prototype.bind.call(this, baseTexture); - + CubeResource.prototype.bind = function (baseTexture) { + _super.prototype.bind.call(this, baseTexture); baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP; }; - + CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) { + if (linkBaseTexture === undefined) { + linkBaseTexture = this.linkBaseTexture; + } + if (!this.items[index]) { + throw new Error("Index " + index + " is out of bounds"); + } + if (!this.linkBaseTexture + || baseTexture.parentTextureArray + || Object.keys(baseTexture._glTextures).length > 0) { + // copy mode + if (baseTexture.resource) { + this.addResourceAt(baseTexture.resource, index); + } + else { + throw new Error("CubeResource does not support copying of renderTexture."); + } + } + else { + // link mode, the difficult one! + baseTexture.target = exports.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index; + baseTexture.parentTextureArray = this.baseTexture; + this.items[index] = baseTexture; + } + if (baseTexture.valid && !this.valid) { + this.resize(baseTexture.realWidth, baseTexture.realHeight); + } + this.items[index] = baseTexture; + return this; + }; /** * Upload the resource * * @returns {boolean} true is success */ - CubeResource.prototype.upload = function upload (renderer, baseTexture, glTexture) - { + CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) { var dirty = this.itemDirtyIds; - - for (var i = 0; i < CubeResource.SIDES; i++) - { + for (var i = 0; i < CubeResource.SIDES; i++) { var side = this.items[i]; - - if (dirty[i] < side.dirtyId) - { - dirty[i] = side.dirtyId; - if (side.valid) - { + if (dirty[i] < side.dirtyId) { + if (side.valid && side.resource) { side.resource.upload(renderer, side, glTexture); + dirty[i] = side.dirtyId; + } + else if (dirty[i] < -1) { + // either item is not valid yet, either its a renderTexture + // allocate the memory + renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null); + dirty[i] = -1; } } } - return true; }; - + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {object} source - The source object + * @return {boolean} `true` if source is an array of 6 elements + */ + CubeResource.test = function (source) { + return Array.isArray(source) && source.length === CubeResource.SIDES; + }; + /** + * Number of texture sides to store for CubeResources + * + * @name PIXI.resources.CubeResource.SIDES + * @static + * @member {number} + * @default 6 + */ + CubeResource.SIDES = 6; return CubeResource; - }(ArrayResource)); + }(AbstractMultiResource)); /** - * Number of texture sides to store for CubeResources - * - * @name PIXI.resources.CubeResource.SIDES - * @static - * @member {number} - * @default 6 + * Resource type for HTMLImageElement. + * @class + * @extends PIXI.resources.BaseImageResource + * @memberof PIXI.resources */ - CubeResource.SIDES = 6; + var ImageResource = /** @class */ (function (_super) { + __extends$2(ImageResource, _super); + /** + * @param {HTMLImageElement|string} source - image source or URL + * @param {object} [options] + * @param {boolean} [options.autoLoad=true] - start loading process + * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create + * a bitmap before upload + * @param {boolean} [options.crossorigin=true] - Load image using cross origin + * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap + */ + function ImageResource(source, options) { + var _this = this; + options = options || {}; + if (!(source instanceof HTMLImageElement)) { + var imageElement = new Image(); + BaseImageResource.crossOrigin(imageElement, source, options.crossorigin); + imageElement.src = source; + source = imageElement; + } + _this = _super.call(this, source) || this; + // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height + // to non-zero values before its loading completes if images are in a cache. + // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images. + // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968). + if (!source.complete && !!_this._width && !!_this._height) { + _this._width = 0; + _this._height = 0; + } + /** + * URL of the image source + * @member {string} + */ + _this.url = source.src; + /** + * When process is completed + * @member {Promise} + * @private + */ + _this._process = null; + /** + * If the image should be disposed after upload + * @member {boolean} + * @default false + */ + _this.preserveBitmap = false; + /** + * If capable, convert the image using createImageBitmap API + * @member {boolean} + * @default PIXI.settings.CREATE_IMAGE_BITMAP + */ + _this.createBitmap = (options.createBitmap !== undefined + ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!window.createImageBitmap; + /** + * Controls texture alphaMode field + * Copies from options + * Default is `null`, copies option from baseTexture + * + * @member {PIXI.ALPHA_MODES|null} + * @readonly + */ + _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null; + if (options.premultiplyAlpha !== undefined) { + // triggers deprecation + _this.premultiplyAlpha = options.premultiplyAlpha; + } + /** + * The ImageBitmap element created for HTMLImageElement + * @member {ImageBitmap} + * @default null + */ + _this.bitmap = null; + /** + * Promise when loading + * @member {Promise} + * @private + * @default null + */ + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); + } + return _this; + } + /** + * returns a promise when image will be loaded and processed + * + * @param {boolean} [createBitmap] - whether process image into bitmap + * @returns {Promise} + */ + ImageResource.prototype.load = function (createBitmap) { + var _this = this; + if (this._load) { + return this._load; + } + if (createBitmap !== undefined) { + this.createBitmap = createBitmap; + } + this._load = new Promise(function (resolve, reject) { + var source = _this.source; + _this.url = source.src; + var completed = function () { + if (_this.destroyed) { + return; + } + source.onload = null; + source.onerror = null; + _this.resize(source.width, source.height); + _this._load = null; + if (_this.createBitmap) { + resolve(_this.process()); + } + else { + resolve(_this); + } + }; + if (source.complete && source.src) { + completed(); + } + else { + source.onload = completed; + source.onerror = function (event) { + // Avoids Promise freezing when resource broken + reject(event); + _this.onError.emit(event); + }; + } + }); + return this._load; + }; + /** + * Called when we need to convert image into BitmapImage. + * Can be called multiple times, real promise is cached inside. + * + * @returns {Promise} cached promise to fill that bitmap + */ + ImageResource.prototype.process = function () { + var _this = this; + var source = this.source; + if (this._process !== null) { + return this._process; + } + if (this.bitmap !== null || !window.createImageBitmap) { + return Promise.resolve(this); + } + this._process = window.createImageBitmap(source, 0, 0, source.width, source.height, { + premultiplyAlpha: this.alphaMode === exports.ALPHA_MODES.UNPACK ? 'premultiply' : 'none', + }) + .then(function (bitmap) { + if (_this.destroyed) { + return Promise.reject(); + } + _this.bitmap = bitmap; + _this.update(); + _this._process = null; + return Promise.resolve(_this); + }); + return this._process; + }; + /** + * Upload the image resource to GPU. + * + * @param {PIXI.Renderer} renderer - Renderer to upload to + * @param {PIXI.BaseTexture} baseTexture - BaseTexture for this resource + * @param {PIXI.GLTexture} glTexture - GLTexture to use + * @returns {boolean} true is success + */ + ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) { + if (typeof this.alphaMode === 'number') { + // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it + baseTexture.alphaMode = this.alphaMode; + } + if (!this.createBitmap) { + return _super.prototype.upload.call(this, renderer, baseTexture, glTexture); + } + if (!this.bitmap) { + // yeah, ignore the output + this.process(); + if (!this.bitmap) { + return false; + } + } + _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap); + if (!this.preserveBitmap) { + // checks if there are other renderers that possibly need this bitmap + var flag = true; + var glTextures = baseTexture._glTextures; + for (var key in glTextures) { + var otherTex = glTextures[key]; + if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) { + flag = false; + break; + } + } + if (flag) { + if (this.bitmap.close) { + this.bitmap.close(); + } + this.bitmap = null; + } + } + return true; + }; + /** + * Destroys this texture + * @override + */ + ImageResource.prototype.dispose = function () { + this.source.onload = null; + this.source.onerror = null; + _super.prototype.dispose.call(this); + if (this.bitmap) { + this.bitmap.close(); + this.bitmap = null; + } + this._process = null; + this._load = null; + }; + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {string|HTMLImageElement} source - The source object + * @return {boolean} `true` if source is string or HTMLImageElement + */ + ImageResource.test = function (source) { + return typeof source === 'string' || source instanceof HTMLImageElement; + }; + return ImageResource; + }(BaseImageResource)); /** * Resource type for SVG elements and graphics. @@ -19215,169 +18303,137 @@ var PIXI = (function (exports) { * @memberof PIXI.resources * @param {string} source - Base64 encoded SVG element or URL for SVG file. * @param {object} [options] - Options to use - * @param {number} [options.scale=1] Scale to apply to SVG. Overridden by... - * @param {number} [options.width] Rasterize SVG this wide. Aspect ratio preserved if height not specified. - * @param {number} [options.height] Rasterize SVG this high. Aspect ratio preserved if width not specified. - * @param {boolean} [options.autoLoad=true] Start loading right away. + * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by... + * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified. + * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified. + * @param {boolean} [options.autoLoad=true] - Start loading right away. */ - var SVGResource = /*@__PURE__*/(function (BaseImageResource) { - function SVGResource(source, options) - { + var SVGResource = /** @class */ (function (_super) { + __extends$2(SVGResource, _super); + function SVGResource(sourceBase64, options) { + var _this = this; options = options || {}; - - BaseImageResource.call(this, document.createElement('canvas')); - this._width = 0; - this._height = 0; - + _this = _super.call(this, document.createElement('canvas')) || this; + _this._width = 0; + _this._height = 0; /** * Base64 encoded SVG element or URL for SVG file * @readonly * @member {string} */ - this.svg = source; - + _this.svg = sourceBase64; /** * The source scale to apply when rasterizing on load * @readonly * @member {number} */ - this.scale = options.scale || 1; - + _this.scale = options.scale || 1; /** * A width override for rasterization on load * @readonly * @member {number} */ - this._overrideWidth = options.width; - + _this._overrideWidth = options.width; /** * A height override for rasterization on load * @readonly * @member {number} */ - this._overrideHeight = options.height; - + _this._overrideHeight = options.height; /** * Call when completely loaded * @private * @member {function} */ - this._resolve = null; - + _this._resolve = null; /** * Cross origin value to use * @private * @member {boolean|string} */ - this._crossorigin = options.crossorigin; - + _this._crossorigin = options.crossorigin; /** * Promise when loading * @member {Promise} * @private * @default null */ - this._load = null; - - if (options.autoLoad !== false) - { - this.load(); + _this._load = null; + if (options.autoLoad !== false) { + _this.load(); } + return _this; } - - if ( BaseImageResource ) { SVGResource.__proto__ = BaseImageResource; } - SVGResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype ); - SVGResource.prototype.constructor = SVGResource; - - SVGResource.prototype.load = function load () - { - var this$1 = this; - - if (this._load) - { + SVGResource.prototype.load = function () { + var _this = this; + if (this._load) { return this._load; } - this._load = new Promise(function (resolve) { // Save this until after load is finished - this$1._resolve = function () { - this$1.resize(this$1.source.width, this$1.source.height); - resolve(this$1); + _this._resolve = function () { + _this.resize(_this.source.width, _this.source.height); + resolve(_this); }; - // Convert SVG inline string to data-uri - if ((/^\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len return SVGResource; }(BaseImageResource)); - /** - * RegExp for SVG size. - * - * @static - * @constant {RegExp|string} SVG_SIZE - * @memberof PIXI.resources.SVGResource - * @example <svg width="100" height="100"></svg> - */ - SVGResource.SVG_SIZE = /]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; // eslint-disable-line max-len - /** * Resource type for HTMLVideoElement. * @class @@ -19453,61 +18499,57 @@ var PIXI = (function (exports) { * Leave at 0 to update at every render. * @param {boolean} [options.crossorigin=true] - Load image using cross origin */ - var VideoResource = /*@__PURE__*/(function (BaseImageResource) { - function VideoResource(source, options) - { + var VideoResource = /** @class */ (function (_super) { + __extends$2(VideoResource, _super); + function VideoResource(source, options) { + var _this = this; options = options || {}; - - if (!(source instanceof HTMLVideoElement)) - { + if (!(source instanceof HTMLVideoElement)) { var videoElement = document.createElement('video'); - // workaround for https://github.com/pixijs/pixi.js/issues/5996 videoElement.setAttribute('preload', 'auto'); videoElement.setAttribute('webkit-playsinline', ''); videoElement.setAttribute('playsinline', ''); - - if (typeof source === 'string') - { + if (typeof source === 'string') { source = [source]; } - - BaseImageResource.crossOrigin(videoElement, (source[0].src || source[0]), options.crossorigin); - + var firstSrc = source[0].src || source[0]; + BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin); // array of objects or strings - for (var i = 0; i < source.length; ++i) - { + for (var i = 0; i < source.length; ++i) { var sourceElement = document.createElement('source'); - - var ref = source[i]; - var src = ref.src; - var mime = ref.mime; - + var _a = source[i], src = _a.src, mime = _a.mime; src = src || source[i]; - var baseSrc = src.split('?').shift().toLowerCase(); var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1); - - mime = mime || ("video/" + ext); - + mime = mime || VideoResource.MIME_TYPES[ext] || "video/" + ext; sourceElement.src = src; sourceElement.type = mime; - videoElement.appendChild(sourceElement); } - // Override the source source = videoElement; } - - BaseImageResource.call(this, source); - - this.noSubImage = true; - this._autoUpdate = true; - this._isAutoUpdating = false; - this._updateFPS = options.updateFPS || 0; - this._msToNextUpdate = 0; - + _this = _super.call(this, source) || this; + _this.noSubImage = true; + /** + * `true` to use PIXI.Ticker.shared to auto update the base texture. + * + * @type {boolean} + * @default true + * @private + */ + _this._autoUpdate = true; + /** + * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture. + * + * @type {boolean} + * @default false + * @private + */ + _this._isConnectedToTicker = false; + _this._updateFPS = options.updateFPS || 0; + _this._msToNextUpdate = 0; /** * When set to true will automatically play videos used by this texture once * they are loaded. If false, it will not modify the playing state. @@ -19515,287 +18557,220 @@ var PIXI = (function (exports) { * @member {boolean} * @default true */ - this.autoPlay = options.autoPlay !== false; - + _this.autoPlay = options.autoPlay !== false; /** * Promise when loading * @member {Promise} * @private * @default null */ - this._load = null; - + _this._load = null; /** * Callback when completed with load. * @member {function} * @private */ - this._resolve = null; - + _this._resolve = null; // Bind for listeners - this._onCanPlay = this._onCanPlay.bind(this); - this._onError = this._onError.bind(this); - - if (options.autoLoad !== false) - { - this.load(); + _this._onCanPlay = _this._onCanPlay.bind(_this); + _this._onError = _this._onError.bind(_this); + if (options.autoLoad !== false) { + _this.load(); } + return _this; } - - if ( BaseImageResource ) { VideoResource.__proto__ = BaseImageResource; } - VideoResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype ); - VideoResource.prototype.constructor = VideoResource; - - var prototypeAccessors = { autoUpdate: { configurable: true },updateFPS: { configurable: true } }; - /** * Trigger updating of the texture * * @param {number} [deltaTime=0] - time delta since last tick */ - VideoResource.prototype.update = function update (deltaTime) - { - if ( deltaTime === void 0 ) { deltaTime = 0; } - - if (!this.destroyed) - { + VideoResource.prototype.update = function (_deltaTime) { + if (_deltaTime === void 0) { _deltaTime = 0; } + if (!this.destroyed) { // account for if video has had its playbackRate changed var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate; - this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS); - if (!this._updateFPS || this._msToNextUpdate <= 0) - { - BaseImageResource.prototype.update.call(this, deltaTime); + if (!this._updateFPS || this._msToNextUpdate <= 0) { + _super.prototype.update.call(this); this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0; } } }; - /** * Start preloading the video resource. * * @protected * @return {Promise} Handle the validate event */ - VideoResource.prototype.load = function load () - { - var this$1 = this; - - if (this._load) - { + VideoResource.prototype.load = function () { + var _this = this; + if (this._load) { return this._load; } - var source = this.source; - if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA) - && source.width && source.height) - { + && source.width && source.height) { source.complete = true; } - source.addEventListener('play', this._onPlayStart.bind(this)); source.addEventListener('pause', this._onPlayStop.bind(this)); - - if (!this._isSourceReady()) - { + if (!this._isSourceReady()) { source.addEventListener('canplay', this._onCanPlay); source.addEventListener('canplaythrough', this._onCanPlay); source.addEventListener('error', this._onError, true); } - else - { + else { this._onCanPlay(); } - this._load = new Promise(function (resolve) { - if (this$1.valid) - { - resolve(this$1); + if (_this.valid) { + resolve(_this); } - else - { - this$1._resolve = resolve; - + else { + _this._resolve = resolve; source.load(); } }); - return this._load; }; - /** * Handle video error events. * * @private */ - VideoResource.prototype._onError = function _onError () - { + VideoResource.prototype._onError = function (event) { this.source.removeEventListener('error', this._onError, true); - this.onError.run(event); + this.onError.emit(event); }; - /** * Returns true if the underlying source is playing. * * @private * @return {boolean} True if playing. */ - VideoResource.prototype._isSourcePlaying = function _isSourcePlaying () - { + VideoResource.prototype._isSourcePlaying = function () { var source = this.source; - return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2); }; - /** * Returns true if the underlying source is ready for playing. * * @private * @return {boolean} True if ready. */ - VideoResource.prototype._isSourceReady = function _isSourceReady () - { - return this.source.readyState === 3 || this.source.readyState === 4; + VideoResource.prototype._isSourceReady = function () { + var source = this.source; + return source.readyState === 3 || source.readyState === 4; }; - /** * Runs the update loop when the video is ready to play * * @private */ - VideoResource.prototype._onPlayStart = function _onPlayStart () - { + VideoResource.prototype._onPlayStart = function () { // Just in case the video has not received its can play even yet.. - if (!this.valid) - { + if (!this.valid) { this._onCanPlay(); } - - if (!this._isAutoUpdating && this.autoUpdate) - { + if (this.autoUpdate && !this._isConnectedToTicker) { Ticker.shared.add(this.update, this); - this._isAutoUpdating = true; + this._isConnectedToTicker = true; } }; - /** * Fired when a pause event is triggered, stops the update loop * * @private */ - VideoResource.prototype._onPlayStop = function _onPlayStop () - { - if (this._isAutoUpdating) - { + VideoResource.prototype._onPlayStop = function () { + if (this._isConnectedToTicker) { Ticker.shared.remove(this.update, this); - this._isAutoUpdating = false; + this._isConnectedToTicker = false; } }; - /** * Fired when the video is loaded and ready to play * * @private */ - VideoResource.prototype._onCanPlay = function _onCanPlay () - { - var ref = this; - var source = ref.source; - + VideoResource.prototype._onCanPlay = function () { + var source = this.source; source.removeEventListener('canplay', this._onCanPlay); source.removeEventListener('canplaythrough', this._onCanPlay); - var valid = this.valid; - this.resize(source.videoWidth, source.videoHeight); - // prevent multiple loaded dispatches.. - if (!valid && this._resolve) - { + if (!valid && this._resolve) { this._resolve(this); this._resolve = null; } - - if (this._isSourcePlaying()) - { + if (this._isSourcePlaying()) { this._onPlayStart(); } - else if (this.autoPlay) - { + else if (this.autoPlay) { source.play(); } }; - /** * Destroys this texture * @override */ - VideoResource.prototype.dispose = function dispose () - { - if (this._isAutoUpdating) - { + VideoResource.prototype.dispose = function () { + if (this._isConnectedToTicker) { Ticker.shared.remove(this.update, this); } - - if (this.source) - { - this.source.removeEventListener('error', this._onError, true); - this.source.pause(); - this.source.src = ''; - this.source.load(); + var source = this.source; + if (source) { + source.removeEventListener('error', this._onError, true); + source.pause(); + source.src = ''; + source.load(); } - BaseImageResource.prototype.dispose.call(this); + _super.prototype.dispose.call(this); }; - - /** - * Should the base texture automatically update itself, set to true by default - * - * @member {boolean} - */ - prototypeAccessors.autoUpdate.get = function () - { - return this._autoUpdate; - }; - - prototypeAccessors.autoUpdate.set = function (value) // eslint-disable-line require-jsdoc - { - if (value !== this._autoUpdate) - { - this._autoUpdate = value; - - if (!this._autoUpdate && this._isAutoUpdating) - { - Ticker.shared.remove(this.update, this); - this._isAutoUpdating = false; + Object.defineProperty(VideoResource.prototype, "autoUpdate", { + /** + * Should the base texture automatically update itself, set to true by default + * + * @member {boolean} + */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } } - else if (this._autoUpdate && !this._isAutoUpdating) - { - Ticker.shared.add(this.update, this); - this._isAutoUpdating = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(VideoResource.prototype, "updateFPS", { + /** + * How many times a second to update the texture from the video. Leave at 0 to update at every render. + * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. + * + * @member {number} + */ + get: function () { + return this._updateFPS; + }, + set: function (value) { + if (value !== this._updateFPS) { + this._updateFPS = value; } - } - }; - - /** - * How many times a second to update the texture from the video. Leave at 0 to update at every render. - * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient. - * - * @member {number} - */ - prototypeAccessors.updateFPS.get = function () - { - return this._updateFPS; - }; - - prototypeAccessors.updateFPS.set = function (value) // eslint-disable-line require-jsdoc - { - if (value !== this._updateFPS) - { - this._updateFPS = value; - } - }; - + }, + enumerable: false, + configurable: true + }); /** * Used to auto-detect the type of resource. * @@ -19804,26 +18779,33 @@ var PIXI = (function (exports) { * @param {string} extension - The extension of source, if set * @return {boolean} `true` if video source */ - VideoResource.test = function test (source, extension) - { + VideoResource.test = function (source, extension) { return (source instanceof HTMLVideoElement) || VideoResource.TYPES.indexOf(extension) > -1; }; - - Object.defineProperties( VideoResource.prototype, prototypeAccessors ); - + /** + * List of common video file extensions supported by VideoResource. + * @constant + * @member {Array} + * @static + * @readonly + */ + VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; + /** + * Map of video MIME types that can't be directly derived from file extensions. + * @constant + * @member {object} + * @static + * @readonly + */ + VideoResource.MIME_TYPES = { + ogv: 'video/ogg', + mov: 'video/quicktime', + m4v: 'video/mp4', + }; return VideoResource; }(BaseImageResource)); - /** - * List of common video file extensions supported by VideoResource. - * @constant - * @member {Array} - * @static - * @readonly - */ - VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov']; - /** * Resource type for ImageBitmap. * @class @@ -19831,47 +18813,40 @@ var PIXI = (function (exports) { * @memberof PIXI.resources * @param {ImageBitmap} source - Image element to use */ - var ImageBitmapResource = /*@__PURE__*/(function (BaseImageResource) { - function ImageBitmapResource () { - BaseImageResource.apply(this, arguments); + var ImageBitmapResource = /** @class */ (function (_super) { + __extends$2(ImageBitmapResource, _super); + function ImageBitmapResource() { + return _super !== null && _super.apply(this, arguments) || this; } - - if ( BaseImageResource ) { ImageBitmapResource.__proto__ = BaseImageResource; } - ImageBitmapResource.prototype = Object.create( BaseImageResource && BaseImageResource.prototype ); - ImageBitmapResource.prototype.constructor = ImageBitmapResource; - - ImageBitmapResource.test = function test (source) - { + /** + * Used to auto-detect the type of resource. + * + * @static + * @param {ImageBitmap} source - The source object + * @return {boolean} `true` if source is an ImageBitmap + */ + ImageBitmapResource.test = function (source) { return !!window.createImageBitmap && source instanceof ImageBitmap; }; - return ImageBitmapResource; }(BaseImageResource)); - INSTALLED.push( - ImageResource, - ImageBitmapResource, - CanvasResource, - VideoResource, - SVGResource, - BufferResource, - CubeResource, - ArrayResource - ); + INSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource); var index = ({ + Resource: Resource, + BaseImageResource: BaseImageResource, INSTALLED: INSTALLED, autoDetectResource: autoDetectResource, + AbstractMultiResource: AbstractMultiResource, ArrayResource: ArrayResource, BufferResource: BufferResource, CanvasResource: CanvasResource, CubeResource: CubeResource, ImageResource: ImageResource, - ImageBitmapResource: ImageBitmapResource, SVGResource: SVGResource, VideoResource: VideoResource, - Resource: Resource, - BaseImageResource: BaseImageResource + ImageBitmapResource: ImageBitmapResource }); /** @@ -19881,23 +18856,26 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var System = function System(renderer) - { + var System = /** @class */ (function () { /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} + * @param {PIXI.Renderer} renderer - The renderer this manager works for. */ - this.renderer = renderer; - }; - - /** - * Generic destroy methods to be overridden by the subclass - */ - System.prototype.destroy = function destroy () - { - this.renderer = null; - }; + function System(renderer) { + /** + * The renderer this manager works for. + * + * @member {PIXI.Renderer} + */ + this.renderer = renderer; + } + /** + * Generic destroy methods to be overridden by the subclass + */ + System.prototype.destroy = function () { + this.renderer = null; + }; + return System; + }()); /** * Resource type for DepthTexture. @@ -19905,56 +18883,33 @@ var PIXI = (function (exports) { * @extends PIXI.resources.BufferResource * @memberof PIXI.resources */ - var DepthResource = /*@__PURE__*/(function (BufferResource) { - function DepthResource () { - BufferResource.apply(this, arguments); + var DepthResource = /** @class */ (function (_super) { + __extends$2(DepthResource, _super); + function DepthResource() { + return _super !== null && _super.apply(this, arguments) || this; } - - if ( BufferResource ) { DepthResource.__proto__ = BufferResource; } - DepthResource.prototype = Object.create( BufferResource && BufferResource.prototype ); - DepthResource.prototype.constructor = DepthResource; - - DepthResource.prototype.upload = function upload (renderer, baseTexture, glTexture) - { + /** + * Upload the texture to the GPU. + * @param {PIXI.Renderer} renderer - Upload to the renderer + * @param {PIXI.BaseTexture} baseTexture - Reference to parent texture + * @param {PIXI.GLTexture} glTexture - glTexture + * @returns {boolean} true is success + */ + DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) { var gl = renderer.gl; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === exports.ALPHA_MODES.UNPACK); - - if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) - { - gl.texSubImage2D( - baseTexture.target, - 0, - 0, - 0, - baseTexture.width, - baseTexture.height, - baseTexture.format, - baseTexture.type, - this.data - ); + if (glTexture.width === baseTexture.width && glTexture.height === baseTexture.height) { + gl.texSubImage2D(baseTexture.target, 0, 0, 0, baseTexture.width, baseTexture.height, baseTexture.format, baseTexture.type, this.data); } - else - { + else { glTexture.width = baseTexture.width; glTexture.height = baseTexture.height; - - gl.texImage2D( - baseTexture.target, - 0, - gl.DEPTH_COMPONENT16, // Needed for depth to render properly in webgl2.0 - baseTexture.width, - baseTexture.height, - 0, - baseTexture.format, - baseTexture.type, - this.data - ); + gl.texImage2D(baseTexture.target, 0, + // gl.DEPTH_COMPONENT16 Needed for depth to render properly in webgl2.0 + renderer.context.webGLVersion === 1 ? gl.DEPTH_COMPONENT : gl.DEPTH_COMPONENT16, baseTexture.width, baseTexture.height, 0, baseTexture.format, baseTexture.type, this.data); } - return true; }; - return DepthResource; }(BufferResource)); @@ -19964,155 +18919,166 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Framebuffer = function Framebuffer(width, height) - { - this.width = Math.ceil(width || 100); - this.height = Math.ceil(height || 100); - - this.stencil = false; - this.depth = false; - - this.dirtyId = 0; - this.dirtyFormat = 0; - this.dirtySize = 0; - - this.depthTexture = null; - this.colorTextures = []; - - this.glFramebuffers = {}; - - this.disposeRunner = new Runner('disposeFramebuffer', 2); - }; - - var prototypeAccessors$1$1 = { colorTexture: { configurable: true } }; - - /** - * Reference to the colorTexture. - * - * @member {PIXI.Texture[]} - * @readonly - */ - prototypeAccessors$1$1.colorTexture.get = function () - { - return this.colorTextures[0]; - }; - - /** - * Add texture to the colorTexture array - * - * @param {number} [index=0] - Index of the array to add the texture to - * @param {PIXI.Texture} [texture] - Texture to add to the array - */ - Framebuffer.prototype.addColorTexture = function addColorTexture (index, texture) - { - if ( index === void 0 ) { index = 0; } - - // TODO add some validation to the texture - same width / height etc? - this.colorTextures[index] = texture || new BaseTexture(null, { scaleMode: 0, - resolution: 1, - mipmap: false, - width: this.width, - height: this.height }); - - this.dirtyId++; - this.dirtyFormat++; - - return this; - }; - - /** - * Add a depth texture to the frame buffer - * - * @param {PIXI.Texture} [texture] - Texture to add - */ - Framebuffer.prototype.addDepthTexture = function addDepthTexture (texture) - { - /* eslint-disable max-len */ - this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { scaleMode: 0, - resolution: 1, - width: this.width, - height: this.height, - mipmap: false, - format: exports.FORMATS.DEPTH_COMPONENT, - type: exports.TYPES.UNSIGNED_SHORT }); - /* eslint-disable max-len */ - this.dirtyId++; - this.dirtyFormat++; - - return this; - }; - - /** - * Enable depth on the frame buffer - */ - Framebuffer.prototype.enableDepth = function enableDepth () - { - this.depth = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - }; - - /** - * Enable stencil on the frame buffer - */ - Framebuffer.prototype.enableStencil = function enableStencil () - { - this.stencil = true; - - this.dirtyId++; - this.dirtyFormat++; - - return this; - }; - - /** - * Resize the frame buffer - * - * @param {number} width - Width of the frame buffer to resize to - * @param {number} height - Height of the frame buffer to resize to - */ - Framebuffer.prototype.resize = function resize (width, height) - { - width = Math.ceil(width); - height = Math.ceil(height); - - if (width === this.width && height === this.height) { return; } - - this.width = width; - this.height = height; - - this.dirtyId++; - this.dirtySize++; - - for (var i = 0; i < this.colorTextures.length; i++) - { - var texture = this.colorTextures[i]; - var resolution = texture.resolution; - - // take into acount the fact the texture may have a different resolution.. - texture.setSize(width / resolution, height / resolution); + var Framebuffer = /** @class */ (function () { + /** + * @param {number} width - Width of the frame buffer + * @param {number} height - Height of the frame buffer + */ + function Framebuffer(width, height) { + /** + * Width of framebuffer in pixels + * @member {number} + */ + this.width = Math.ceil(width || 100); + /** + * Height of framebuffer in pixels + * @member {number} + */ + this.height = Math.ceil(height || 100); + this.stencil = false; + this.depth = false; + this.dirtyId = 0; + this.dirtyFormat = 0; + this.dirtySize = 0; + this.depthTexture = null; + this.colorTextures = []; + this.glFramebuffers = {}; + this.disposeRunner = new Runner('disposeFramebuffer'); + /** + * Desired number of samples for antialiasing. 0 means AA should not be used. + * + * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures. + * Antialiasing is the same as for main buffer with renderer `antialias:true` options. + * Seriously affects GPU memory consumption and GPU performance. + * + *```js + * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH; + * //... + * renderer.render(renderTexture, myContainer); + * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture + * ``` + * + * @member {PIXI.MSAA_QUALITY} + * @default PIXI.MSAA_QUALITY.NONE + */ + this.multisample = exports.MSAA_QUALITY.NONE; } - - if (this.depthTexture) - { - var resolution$1 = this.depthTexture.resolution; - - this.depthTexture.setSize(width / resolution$1, height / resolution$1); - } - }; - - /** - * disposes WebGL resources that are connected to this geometry - */ - Framebuffer.prototype.dispose = function dispose () - { - this.disposeRunner.run(this, false); - }; - - Object.defineProperties( Framebuffer.prototype, prototypeAccessors$1$1 ); + Object.defineProperty(Framebuffer.prototype, "colorTexture", { + /** + * Reference to the colorTexture. + * + * @member {PIXI.BaseTexture[]} + * @readonly + */ + get: function () { + return this.colorTextures[0]; + }, + enumerable: false, + configurable: true + }); + /** + * Add texture to the colorTexture array + * + * @param {number} [index=0] - Index of the array to add the texture to + * @param {PIXI.BaseTexture} [texture] - Texture to add to the array + */ + Framebuffer.prototype.addColorTexture = function (index, texture) { + if (index === void 0) { index = 0; } + // TODO add some validation to the texture - same width / height etc? + this.colorTextures[index] = texture || new BaseTexture(null, { + scaleMode: exports.SCALE_MODES.NEAREST, + resolution: 1, + mipmap: exports.MIPMAP_MODES.OFF, + width: this.width, + height: this.height, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Add a depth texture to the frame buffer + * + * @param {PIXI.BaseTexture} [texture] - Texture to add + */ + Framebuffer.prototype.addDepthTexture = function (texture) { + /* eslint-disable max-len */ + this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), { + scaleMode: exports.SCALE_MODES.NEAREST, + resolution: 1, + width: this.width, + height: this.height, + mipmap: exports.MIPMAP_MODES.OFF, + format: exports.FORMATS.DEPTH_COMPONENT, + type: exports.TYPES.UNSIGNED_SHORT, + }); + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Enable depth on the frame buffer + */ + Framebuffer.prototype.enableDepth = function () { + this.depth = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Enable stencil on the frame buffer + */ + Framebuffer.prototype.enableStencil = function () { + this.stencil = true; + this.dirtyId++; + this.dirtyFormat++; + return this; + }; + /** + * Resize the frame buffer + * + * @param {number} width - Width of the frame buffer to resize to + * @param {number} height - Height of the frame buffer to resize to + */ + Framebuffer.prototype.resize = function (width, height) { + width = Math.ceil(width); + height = Math.ceil(height); + if (width === this.width && height === this.height) + { return; } + this.width = width; + this.height = height; + this.dirtyId++; + this.dirtySize++; + for (var i = 0; i < this.colorTextures.length; i++) { + var texture = this.colorTextures[i]; + var resolution = texture.resolution; + // take into acount the fact the texture may have a different resolution.. + texture.setSize(width / resolution, height / resolution); + } + if (this.depthTexture) { + var resolution = this.depthTexture.resolution; + this.depthTexture.setSize(width / resolution, height / resolution); + } + }; + /** + * Disposes WebGL resources that are connected to this geometry + */ + Framebuffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys and removes the depth texture added to this framebuffer. + */ + Framebuffer.prototype.destroyDepthTexture = function () { + if (this.depthTexture) { + this.depthTexture.destroy(); + this.depthTexture = null; + ++this.dirtyId; + ++this.dirtyFormat; + } + }; + return Framebuffer; + }()); /** * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it. @@ -20154,81 +19120,63 @@ var PIXI = (function (exports) { * @extends PIXI.BaseTexture * @memberof PIXI */ - var BaseRenderTexture = /*@__PURE__*/(function (BaseTexture) { - function BaseRenderTexture(options) - { - if (typeof options === 'number') - { + var BaseRenderTexture = /** @class */ (function (_super) { + __extends$2(BaseRenderTexture, _super); + /** + * @param {object} [options] + * @param {number} [options.width=100] - The width of the base render texture. + * @param {number} [options.height=100] - The height of the base render texture. + * @param {PIXI.SCALE_MODES} [options.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated. + */ + function BaseRenderTexture(options) { + var _this = this; + if (typeof options === 'number') { /* eslint-disable prefer-rest-params */ // Backward compatibility of signature - var width$1 = arguments[0]; - var height$1 = arguments[1]; + var width_1 = arguments[0]; + var height_1 = arguments[1]; var scaleMode = arguments[2]; var resolution = arguments[3]; - - options = { width: width$1, height: height$1, scaleMode: scaleMode, resolution: resolution }; + options = { width: width_1, height: height_1, scaleMode: scaleMode, resolution: resolution }; /* eslint-enable prefer-rest-params */ } - - BaseTexture.call(this, null, options); - - var ref = options || {}; - var width = ref.width; - var height = ref.height; - + _this = _super.call(this, null, options) || this; + var _a = options || {}, width = _a.width, height = _a.height; // Set defaults - this.mipmap = false; - this.width = Math.ceil(width) || 100; - this.height = Math.ceil(height) || 100; - this.valid = true; - - /** - * A reference to the canvas render target (we only need one as this can be shared across renderers) - * - * @protected - * @member {object} - */ - this._canvasRenderTarget = null; - - this.clearColor = [0, 0, 0, 0]; - - this.framebuffer = new Framebuffer(this.width * this.resolution, this.height * this.resolution) - .addColorTexture(0, this); - + _this.mipmap = 0; + _this.width = Math.ceil(width) || 100; + _this.height = Math.ceil(height) || 100; + _this.valid = true; + _this.clearColor = [0, 0, 0, 0]; + _this.framebuffer = new Framebuffer(_this.width * _this.resolution, _this.height * _this.resolution) + .addColorTexture(0, _this); // TODO - could this be added the systems? - /** * The data structure for the stencil masks. * * @member {PIXI.MaskData[]} */ - this.maskStack = []; - + _this.maskStack = []; /** * The data structure for the filters. * * @member {Object[]} */ - this.filterStack = [{}]; + _this.filterStack = [{}]; + return _this; } - - if ( BaseTexture ) { BaseRenderTexture.__proto__ = BaseTexture; } - BaseRenderTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype ); - BaseRenderTexture.prototype.constructor = BaseRenderTexture; - /** * Resizes the BaseRenderTexture. * * @param {number} width - The width to resize to. * @param {number} height - The height to resize to. */ - BaseRenderTexture.prototype.resize = function resize (width, height) - { + BaseRenderTexture.prototype.resize = function (width, height) { width = Math.ceil(width); height = Math.ceil(height); this.framebuffer.resize(width * this.resolution, height * this.resolution); }; - /** * Frees the texture and framebuffer from WebGL memory without destroying this texture object. * This means you can still use the texture later which will upload it to GPU @@ -20236,24 +19184,18 @@ var PIXI = (function (exports) { * * @fires PIXI.BaseTexture#dispose */ - BaseRenderTexture.prototype.dispose = function dispose () - { + BaseRenderTexture.prototype.dispose = function () { this.framebuffer.dispose(); - - BaseTexture.prototype.dispose.call(this); + _super.prototype.dispose.call(this); }; - /** * Destroys this texture. - * */ - BaseRenderTexture.prototype.destroy = function destroy () - { - BaseTexture.prototype.destroy.call(this, true); - + BaseRenderTexture.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.framebuffer.destroyDepthTexture(); this.framebuffer = null; }; - return BaseRenderTexture; }(BaseTexture)); @@ -20273,133 +19215,112 @@ var PIXI = (function (exports) { * @protected * @memberof PIXI */ - var TextureUvs = function TextureUvs() - { - /** - * X-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.x0 = 0; - - /** - * Y-component of top-left corner `(x0,y0)`. - * - * @member {number} - */ - this.y0 = 0; - - /** - * X-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.x1 = 1; - - /** - * Y-component of top-right corner `(x1,y1)`. - * - * @member {number} - */ - this.y1 = 0; - - /** - * X-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.x2 = 1; - - /** - * Y-component of bottom-right corner `(x2,y2)`. - * - * @member {number} - */ - this.y2 = 1; - - /** - * X-component of bottom-left corner `(x3,y3)`. - * - * @member {number} - */ - this.x3 = 0; - - /** - * Y-component of bottom-right corner `(x3,y3)`. - * - * @member {number} - */ - this.y3 = 1; - - this.uvsFloat32 = new Float32Array(8); - }; - - /** - * Sets the texture Uvs based on the given frame information. - * - * @protected - * @param {PIXI.Rectangle} frame - The frame of the texture - * @param {PIXI.Rectangle} baseFrame - The base frame of the texture - * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8} - */ - TextureUvs.prototype.set = function set (frame, baseFrame, rotate) - { - var tw = baseFrame.width; - var th = baseFrame.height; - - if (rotate) - { - // width and height div 2 div baseFrame size - var w2 = frame.width / 2 / tw; - var h2 = frame.height / 2 / th; - - // coordinates of center - var cX = (frame.x / tw) + w2; - var cY = (frame.y / th) + h2; - - rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner - this.x0 = cX + (w2 * groupD8.uX(rotate)); - this.y0 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise - this.x1 = cX + (w2 * groupD8.uX(rotate)); - this.y1 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); - this.x2 = cX + (w2 * groupD8.uX(rotate)); - this.y2 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); - this.x3 = cX + (w2 * groupD8.uX(rotate)); - this.y3 = cY + (h2 * groupD8.uY(rotate)); + var TextureUvs = /** @class */ (function () { + function TextureUvs() { + /** + * X-component of top-left corner `(x0,y0)`. + * + * @member {number} + */ + this.x0 = 0; + /** + * Y-component of top-left corner `(x0,y0)`. + * + * @member {number} + */ + this.y0 = 0; + /** + * X-component of top-right corner `(x1,y1)`. + * + * @member {number} + */ + this.x1 = 1; + /** + * Y-component of top-right corner `(x1,y1)`. + * + * @member {number} + */ + this.y1 = 0; + /** + * X-component of bottom-right corner `(x2,y2)`. + * + * @member {number} + */ + this.x2 = 1; + /** + * Y-component of bottom-right corner `(x2,y2)`. + * + * @member {number} + */ + this.y2 = 1; + /** + * X-component of bottom-left corner `(x3,y3)`. + * + * @member {number} + */ + this.x3 = 0; + /** + * Y-component of bottom-right corner `(x3,y3)`. + * + * @member {number} + */ + this.y3 = 1; + this.uvsFloat32 = new Float32Array(8); } - else - { - this.x0 = frame.x / tw; - this.y0 = frame.y / th; - - this.x1 = (frame.x + frame.width) / tw; - this.y1 = frame.y / th; - - this.x2 = (frame.x + frame.width) / tw; - this.y2 = (frame.y + frame.height) / th; - - this.x3 = frame.x / tw; - this.y3 = (frame.y + frame.height) / th; - } - - this.uvsFloat32[0] = this.x0; - this.uvsFloat32[1] = this.y0; - this.uvsFloat32[2] = this.x1; - this.uvsFloat32[3] = this.y1; - this.uvsFloat32[4] = this.x2; - this.uvsFloat32[5] = this.y2; - this.uvsFloat32[6] = this.x3; - this.uvsFloat32[7] = this.y3; - }; + /** + * Sets the texture Uvs based on the given frame information. + * + * @protected + * @param {PIXI.Rectangle} frame - The frame of the texture + * @param {PIXI.Rectangle} baseFrame - The base frame of the texture + * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8} + */ + TextureUvs.prototype.set = function (frame, baseFrame, rotate) { + var tw = baseFrame.width; + var th = baseFrame.height; + if (rotate) { + // width and height div 2 div baseFrame size + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; + // coordinates of center + var cX = (frame.x / tw) + w2; + var cY = (frame.y / th) + h2; + rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner + this.x0 = cX + (w2 * groupD8.uX(rotate)); + this.y0 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise + this.x1 = cX + (w2 * groupD8.uX(rotate)); + this.y1 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x2 = cX + (w2 * groupD8.uX(rotate)); + this.y2 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + this.x3 = cX + (w2 * groupD8.uX(rotate)); + this.y3 = cY + (h2 * groupD8.uY(rotate)); + } + else { + this.x0 = frame.x / tw; + this.y0 = frame.y / th; + this.x1 = (frame.x + frame.width) / tw; + this.y1 = frame.y / th; + this.x2 = (frame.x + frame.width) / tw; + this.y2 = (frame.y + frame.height) / th; + this.x3 = frame.x / tw; + this.y3 = (frame.y + frame.height) / th; + } + this.uvsFloat32[0] = this.x0; + this.uvsFloat32[1] = this.y0; + this.uvsFloat32[2] = this.x1; + this.uvsFloat32[3] = this.y1; + this.uvsFloat32[4] = this.x2; + this.uvsFloat32[5] = this.y2; + this.uvsFloat32[6] = this.x3; + this.uvsFloat32[7] = this.y3; + }; + return TextureUvs; + }()); var DEFAULT_UVS = new TextureUvs(); - /** * A texture stores the information that represents an image or part of an image. * @@ -20430,11 +19351,18 @@ var PIXI = (function (exports) { * @extends PIXI.utils.EventEmitter * @memberof PIXI */ - var Texture = /*@__PURE__*/(function (EventEmitter) { - function Texture(baseTexture, frame, orig, trim, rotate, anchor) - { - EventEmitter.call(this); - + var Texture = /** @class */ (function (_super) { + __extends$2(Texture, _super); + /** + * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + * @param {PIXI.Rectangle} [orig] - The area of original texture + * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture + * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8} + * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation + */ + function Texture(baseTexture, frame, orig, trim, rotate, anchor) { + var _this = _super.call(this) || this; /** * Does this Texture have any frame data assigned to it? * @@ -20453,99 +19381,75 @@ var PIXI = (function (exports) { * * @member {boolean} */ - this.noFrame = false; - - if (!frame) - { - this.noFrame = true; + _this.noFrame = false; + if (!frame) { + _this.noFrame = true; frame = new Rectangle(0, 0, 1, 1); } - - if (baseTexture instanceof Texture) - { + if (baseTexture instanceof Texture) { baseTexture = baseTexture.baseTexture; } - /** * The base texture that this texture uses. * * @member {PIXI.BaseTexture} */ - this.baseTexture = baseTexture; - + _this.baseTexture = baseTexture; /** * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases) * * @member {PIXI.Rectangle} */ - this._frame = frame; - + _this._frame = frame; /** * This is the trimmed area of original texture, before it was put in atlas * Please call `updateUvs()` after you change coordinates of `trim` manually. * * @member {PIXI.Rectangle} */ - this.trim = trim; - + _this.trim = trim; /** * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. * * @member {boolean} */ - this.valid = false; - - /** - * This will let a renderer know that a texture has been updated (used mainly for WebGL uv updates) - * - * @member {boolean} - */ - this.requiresUpdate = false; - + _this.valid = false; /** * The WebGL UV data cache. Can be used as quad UV * * @member {PIXI.TextureUvs} * @protected */ - this._uvs = DEFAULT_UVS; - + _this._uvs = DEFAULT_UVS; /** * Default TextureMatrix instance for this texture * By default that object is not created because its heavy * * @member {PIXI.TextureMatrix} */ - this.uvMatrix = null; - + _this.uvMatrix = null; /** * This is the area of original texture, before it was put in atlas * * @member {PIXI.Rectangle} */ - this.orig = orig || frame;// new Rectangle(0, 0, 1, 1); - - this._rotate = Number(rotate || 0); - - if (rotate === true) - { + _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1); + _this._rotate = Number(rotate || 0); + if (rotate === true) { // this is old texturepacker legacy, some games/libraries are passing "true" for rotated textures - this._rotate = 2; + _this._rotate = 2; } - else if (this._rotate % 2 !== 0) - { + else if (_this._rotate % 2 !== 0) { throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually'); } - /** * Anchor point that is used as default if sprite is created with this texture. * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point. * @member {PIXI.Point} * @default {0,0} */ - this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); - + _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0); /** * Update ID is observed by sprites and TextureMatrix instances. * Call updateUvs() to increment it. @@ -20553,9 +19457,7 @@ var PIXI = (function (exports) { * @member {number} * @protected */ - - this._updateID = 0; - + _this._updateID = 0; /** * The ids under which this Texture has been added to the texture cache. This is * automatically set as long as Texture.addToCache is used, but may not be set if a @@ -20563,37 +19465,24 @@ var PIXI = (function (exports) { * * @member {string[]} */ - this.textureCacheIds = []; - - if (!baseTexture.valid) - { - baseTexture.once('loaded', this.onBaseTextureUpdated, this); + _this.textureCacheIds = []; + if (!baseTexture.valid) { + baseTexture.once('loaded', _this.onBaseTextureUpdated, _this); } - else if (this.noFrame) - { + else if (_this.noFrame) { // if there is no frame we should monitor for any base texture changes.. - if (baseTexture.valid) - { - this.onBaseTextureUpdated(baseTexture); + if (baseTexture.valid) { + _this.onBaseTextureUpdated(baseTexture); } } - else - { - this.frame = frame; + else { + _this.frame = frame; } - - if (this.noFrame) - { - baseTexture.on('update', this.onBaseTextureUpdated, this); + if (_this.noFrame) { + baseTexture.on('update', _this.onBaseTextureUpdated, _this); } + return _this; } - - if ( EventEmitter ) { Texture.__proto__ = EventEmitter; } - Texture.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - Texture.prototype.constructor = Texture; - - var prototypeAccessors = { resolution: { configurable: true },frame: { configurable: true },rotate: { configurable: true },width: { configurable: true },height: { configurable: true } }; - /** * Updates this texture on the gpu. * @@ -20602,110 +19491,81 @@ var PIXI = (function (exports) { * If you adjusted `frame` manually, please call `updateUvs()` instead. * */ - Texture.prototype.update = function update () - { - if (this.baseTexture.resource) - { + Texture.prototype.update = function () { + if (this.baseTexture.resource) { this.baseTexture.resource.update(); } }; - /** * Called when the base texture is updated * * @protected * @param {PIXI.BaseTexture} baseTexture - The base texture. */ - Texture.prototype.onBaseTextureUpdated = function onBaseTextureUpdated (baseTexture) - { - if (this.noFrame) - { - if (!this.baseTexture.valid) - { + Texture.prototype.onBaseTextureUpdated = function (baseTexture) { + if (this.noFrame) { + if (!this.baseTexture.valid) { return; } - this._frame.width = baseTexture.width; this._frame.height = baseTexture.height; this.valid = true; this.updateUvs(); } - else - { + else { // TODO this code looks confusing.. boo to abusing getters and setters! // if user gave us frame that has bigger size than resized texture it can be a problem this.frame = this._frame; } - this.emit('update', this); }; - /** * Destroys this texture * - * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well + * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well */ - Texture.prototype.destroy = function destroy (destroyBase) - { - if (this.baseTexture) - { - if (destroyBase) - { - var ref = this.baseTexture; - var resource = ref.resource; - + Texture.prototype.destroy = function (destroyBase) { + if (this.baseTexture) { + if (destroyBase) { + var resource = this.baseTexture; // delete the texture if it exists in the texture cache.. // this only needs to be removed if the base texture is actually destroyed too.. - if (resource && TextureCache[resource.url]) - { + if (resource && resource.url && TextureCache[resource.url]) { Texture.removeFromCache(resource.url); } - this.baseTexture.destroy(); } - + this.baseTexture.off('loaded', this.onBaseTextureUpdated, this); this.baseTexture.off('update', this.onBaseTextureUpdated, this); - this.baseTexture = null; } - this._frame = null; this._uvs = null; this.trim = null; this.orig = null; - this.valid = false; - Texture.removeFromCache(this); this.textureCacheIds = null; }; - /** * Creates a new texture object that acts the same as this one. * * @return {PIXI.Texture} The new texture */ - Texture.prototype.clone = function clone () - { - return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor); + Texture.prototype.clone = function () { + return new Texture(this.baseTexture, this.frame.clone(), this.orig.clone(), this.trim && this.trim.clone(), this.rotate, this.defaultAnchor); }; - /** * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture. * Call it after changing the frame */ - Texture.prototype.updateUvs = function updateUvs () - { - if (this._uvs === DEFAULT_UVS) - { + Texture.prototype.updateUvs = function () { + if (this._uvs === DEFAULT_UVS) { this._uvs = new TextureUvs(); } - this._uvs.set(this._frame, this.baseTexture, this.rotate); - this._updateID++; }; - /** * Helper function that creates a new Texture based on the source you provide. * The source can be - frame id, image url, video url, canvas element, video element, base texture @@ -20714,73 +19574,73 @@ var PIXI = (function (exports) { * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source * Source to create texture from * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. - * @param {boolean} [strict] Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. + * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}. * @return {PIXI.Texture} The newly created texture */ - Texture.from = function from (source, options, strict) - { - if ( options === void 0 ) { options = {}; } - if ( strict === void 0 ) { strict = settings.STRICT_TEXTURE_CACHE; } - + Texture.from = function (source, options, strict) { + if (options === void 0) { options = {}; } + if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; } var isFrame = typeof source === 'string'; var cacheId = null; - - if (isFrame) - { + if (isFrame) { cacheId = source; } - else - { - if (!source._pixiId) - { - source._pixiId = "pixiid_" + (uid()); + else { + if (!source._pixiId) { + source._pixiId = "pixiid_" + uid(); } - cacheId = source._pixiId; } - var texture = TextureCache[cacheId]; - // Strict-mode rejects invalid cacheIds - if (isFrame && strict && !texture) - { - throw new Error(("The cacheId \"" + cacheId + "\" does not exist in TextureCache.")); + if (isFrame && strict && !texture) { + throw new Error("The cacheId \"" + cacheId + "\" does not exist in TextureCache."); } - - if (!texture) - { - if (!options.resolution) - { + if (!texture) { + if (!options.resolution) { options.resolution = getResolutionOfUrl(source); } - texture = new Texture(new BaseTexture(source, options)); texture.baseTexture.cacheId = cacheId; - BaseTexture.addToCache(texture.baseTexture, cacheId); Texture.addToCache(texture, cacheId); } - // lets assume its a base texture! return texture; }; - + /** + * Useful for loading textures via URLs. Use instead of `Texture.from` because + * it does a better job of handling failed URLs more effectively. This also ignores + * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images. + * @param {string} url The remote URL to load. + * @param {object} [options] Optional options to include + * @return {Promise} A Promise that resolves to a Texture. + */ + Texture.fromURL = function (url, options) { + var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions); + var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false); + var resource = texture.baseTexture.resource; + // The texture was already loaded + if (texture.baseTexture.valid) { + return Promise.resolve(texture); + } + // Manually load the texture, this should allow users to handle load errors + return resource.load().then(function () { return Promise.resolve(texture); }); + }; /** * Create a new Texture with a BufferResource from a Float32Array. * RGBA values are floats from 0 to 1. * @static - * @param {Float32Array|Uint8Array} buffer The optional array to use, if no data + * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data * is provided, a new Float32Array is created. * @param {number} width - Width of the resource * @param {number} height - Height of the resource * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. * @return {PIXI.Texture} The resulting new BaseTexture */ - Texture.fromBuffer = function fromBuffer (buffer, width, height, options) - { + Texture.fromBuffer = function (buffer, width, height, options) { return new Texture(BaseTexture.fromBuffer(buffer, width, height, options)); }; - /** * Create a texture from a source and add to the cache. * @@ -20791,39 +19651,28 @@ var PIXI = (function (exports) { * specified, only `imageUrl` will be used as the cache ID. * @return {PIXI.Texture} Output texture */ - Texture.fromLoader = function fromLoader (source, imageUrl, name) - { + Texture.fromLoader = function (source, imageUrl, name) { var resource = new ImageResource(source); - resource.url = imageUrl; - var baseTexture = new BaseTexture(resource, { scaleMode: settings.SCALE_MODE, resolution: getResolutionOfUrl(imageUrl), }); - var texture = new Texture(baseTexture); - // No name, use imageUrl instead - if (!name) - { + if (!name) { name = imageUrl; } - // lets also add the frame to pixi's global cache for 'fromLoader' function BaseTexture.addToCache(texture.baseTexture, name); Texture.addToCache(texture, name); - // also add references by url if they are different. - if (name !== imageUrl) - { + if (name !== imageUrl) { BaseTexture.addToCache(texture.baseTexture, imageUrl); Texture.addToCache(texture, imageUrl); } - return texture; }; - /** * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object. * @@ -20831,25 +19680,18 @@ var PIXI = (function (exports) { * @param {PIXI.Texture} texture - The Texture to add to the cache. * @param {string} id - The id that the Texture will be stored against. */ - Texture.addToCache = function addToCache (texture, id) - { - if (id) - { - if (texture.textureCacheIds.indexOf(id) === -1) - { + Texture.addToCache = function (texture, id) { + if (id) { + if (texture.textureCacheIds.indexOf(id) === -1) { texture.textureCacheIds.push(id); } - - if (TextureCache[id]) - { + if (TextureCache[id]) { // eslint-disable-next-line no-console - console.warn(("Texture added to the cache with an id [" + id + "] that already had an entry")); + console.warn("Texture added to the cache with an id [" + id + "] that already had an entry"); } - TextureCache[id] = texture; } }; - /** * Remove a Texture from the global TextureCache. * @@ -20857,174 +19699,146 @@ var PIXI = (function (exports) { * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself * @return {PIXI.Texture|null} The Texture that was removed */ - Texture.removeFromCache = function removeFromCache (texture) - { - if (typeof texture === 'string') - { + Texture.removeFromCache = function (texture) { + if (typeof texture === 'string') { var textureFromCache = TextureCache[texture]; - - if (textureFromCache) - { + if (textureFromCache) { var index = textureFromCache.textureCacheIds.indexOf(texture); - - if (index > -1) - { + if (index > -1) { textureFromCache.textureCacheIds.splice(index, 1); } - delete TextureCache[texture]; - return textureFromCache; } } - else if (texture && texture.textureCacheIds) - { - for (var i = 0; i < texture.textureCacheIds.length; ++i) - { + else if (texture && texture.textureCacheIds) { + for (var i = 0; i < texture.textureCacheIds.length; ++i) { // Check that texture matches the one being passed in before deleting it from the cache. - if (TextureCache[texture.textureCacheIds[i]] === texture) - { + if (TextureCache[texture.textureCacheIds[i]] === texture) { delete TextureCache[texture.textureCacheIds[i]]; } } - texture.textureCacheIds.length = 0; - return texture; } - return null; }; - + Object.defineProperty(Texture.prototype, "resolution", { + /** + * Returns resolution of baseTexture + * + * @member {number} + * @readonly + */ + get: function () { + return this.baseTexture.resolution; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "frame", { + /** + * The frame specifies the region of the base texture that this texture uses. + * Please call `updateUvs()` after you change coordinates of `frame` manually. + * + * @member {PIXI.Rectangle} + */ + get: function () { + return this._frame; + }, + set: function (frame) { + this._frame = frame; + this.noFrame = false; + var x = frame.x, y = frame.y, width = frame.width, height = frame.height; + var xNotFit = x + width > this.baseTexture.width; + var yNotFit = y + height > this.baseTexture.height; + if (xNotFit || yNotFit) { + var relationship = xNotFit && yNotFit ? 'and' : 'or'; + var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + this.baseTexture.width; + var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + this.baseTexture.height; + throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' + + (errorX + " " + relationship + " " + errorY)); + } + this.valid = width && height && this.baseTexture.valid; + if (!this.trim && !this.rotate) { + this.orig = frame; + } + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "rotate", { + /** + * Indicates whether the texture is rotated inside the atlas + * set to 2 to compensate for texture packer rotation + * set to 6 to compensate for spine packer rotation + * can be used to rotate or mirror sprites + * See {@link PIXI.groupD8} for explanation + * + * @member {number} + */ + get: function () { + return this._rotate; + }, + set: function (rotate) { + this._rotate = rotate; + if (this.valid) { + this.updateUvs(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "width", { + /** + * The width of the Texture in pixels. + * + * @member {number} + */ + get: function () { + return this.orig.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Texture.prototype, "height", { + /** + * The height of the Texture in pixels. + * + * @member {number} + */ + get: function () { + return this.orig.height; + }, + enumerable: false, + configurable: true + }); /** - * Returns resolution of baseTexture - * - * @member {number} - * @readonly + * Utility function for BaseTexture|Texture cast */ - prototypeAccessors.resolution.get = function () - { - return this.baseTexture.resolution; + Texture.prototype.castToBaseTexture = function () { + return this.baseTexture; }; - - /** - * The frame specifies the region of the base texture that this texture uses. - * Please call `updateUvs()` after you change coordinates of `frame` manually. - * - * @member {PIXI.Rectangle} - */ - prototypeAccessors.frame.get = function () - { - return this._frame; - }; - - prototypeAccessors.frame.set = function (frame) // eslint-disable-line require-jsdoc - { - this._frame = frame; - - this.noFrame = false; - - var x = frame.x; - var y = frame.y; - var width = frame.width; - var height = frame.height; - var xNotFit = x + width > this.baseTexture.width; - var yNotFit = y + height > this.baseTexture.height; - - if (xNotFit || yNotFit) - { - var relationship = xNotFit && yNotFit ? 'and' : 'or'; - var errorX = "X: " + x + " + " + width + " = " + (x + width) + " > " + (this.baseTexture.width); - var errorY = "Y: " + y + " + " + height + " = " + (y + height) + " > " + (this.baseTexture.height); - - throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: ' - + errorX + " " + relationship + " " + errorY); - } - - this.valid = width && height && this.baseTexture.valid; - - if (!this.trim && !this.rotate) - { - this.orig = frame; - } - - if (this.valid) - { - this.updateUvs(); - } - }; - - /** - * Indicates whether the texture is rotated inside the atlas - * set to 2 to compensate for texture packer rotation - * set to 6 to compensate for spine packer rotation - * can be used to rotate or mirror sprites - * See {@link PIXI.groupD8} for explanation - * - * @member {number} - */ - prototypeAccessors.rotate.get = function () - { - return this._rotate; - }; - - prototypeAccessors.rotate.set = function (rotate) // eslint-disable-line require-jsdoc - { - this._rotate = rotate; - if (this.valid) - { - this.updateUvs(); - } - }; - - /** - * The width of the Texture in pixels. - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return this.orig.width; - }; - - /** - * The height of the Texture in pixels. - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return this.orig.height; - }; - - Object.defineProperties( Texture.prototype, prototypeAccessors ); - return Texture; }(eventemitter3)); - - function createWhiteTexture() - { + function createWhiteTexture() { var canvas = document.createElement('canvas'); - canvas.width = 16; canvas.height = 16; - var context = canvas.getContext('2d'); - context.fillStyle = 'white'; context.fillRect(0, 0, 16, 16); - return new Texture(new BaseTexture(new CanvasResource(canvas))); } - - function removeAllHandlers(tex) - { - tex.destroy = function _emptyDestroy() { /* empty */ }; - tex.on = function _emptyOn() { /* empty */ }; - tex.once = function _emptyOnce() { /* empty */ }; - tex.emit = function _emptyEmit() { /* empty */ }; + function removeAllHandlers(tex) { + tex.destroy = function _emptyDestroy() { }; + tex.on = function _emptyOn() { }; + tex.once = function _emptyOnce() { }; + tex.emit = function _emptyEmit() { }; } - /** * An empty texture, used often to not have to create multiple empty textures. * Can not be destroyed. @@ -21036,7 +19850,6 @@ var PIXI = (function (exports) { Texture.EMPTY = new Texture(new BaseTexture()); removeAllHandlers(Texture.EMPTY); removeAllHandlers(Texture.EMPTY.baseTexture); - /** * A white texture of 16x16 size, used for graphics and other things * Can not be destroyed. @@ -21062,7 +19875,7 @@ var PIXI = (function (exports) { * * ```js * let renderer = PIXI.autoDetectRenderer(); - * let renderTexture = PIXI.RenderTexture.create(800, 600); + * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 }); * let sprite = PIXI.Sprite.from("spinObj_01.png"); * * sprite.position.x = 800/2; @@ -21089,25 +19902,26 @@ var PIXI = (function (exports) { * @extends PIXI.Texture * @memberof PIXI */ - var RenderTexture = /*@__PURE__*/(function (Texture) { - function RenderTexture(baseRenderTexture, frame) - { + var RenderTexture = /** @class */ (function (_super) { + __extends$2(RenderTexture, _super); + /** + * @param {PIXI.BaseRenderTexture} baseRenderTexture - The base texture object that this texture uses + * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show + */ + function RenderTexture(baseRenderTexture, frame) { + var _this = this; // support for legacy.. var _legacyRenderer = null; - - if (!(baseRenderTexture instanceof BaseRenderTexture)) - { + if (!(baseRenderTexture instanceof BaseRenderTexture)) { /* eslint-disable prefer-rest-params, no-console */ var width = arguments[1]; var height = arguments[2]; var scaleMode = arguments[3]; var resolution = arguments[4]; - // we have an old render texture.. - console.warn(("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly.")); + console.warn("Please use RenderTexture.create(" + width + ", " + height + ") instead of the ctor directly."); _legacyRenderer = arguments[0]; /* eslint-enable prefer-rest-params, no-console */ - frame = null; baseRenderTexture = new BaseRenderTexture({ width: width, @@ -21116,23 +19930,19 @@ var PIXI = (function (exports) { resolution: resolution, }); } - /** * The base texture object that this texture uses * * @member {PIXI.BaseTexture} */ - Texture.call(this, baseRenderTexture, frame); - - this.legacyRenderer = _legacyRenderer; - + _this = _super.call(this, baseRenderTexture, frame) || this; + _this.legacyRenderer = _legacyRenderer; /** * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered. * * @member {boolean} */ - this.valid = true; - + _this.valid = true; /** * Stores `sourceFrame` when this texture is inside current filter stack. * You can read it inside filters. @@ -21140,22 +19950,28 @@ var PIXI = (function (exports) { * @readonly * @member {PIXI.Rectangle} */ - this.filterFrame = null; - + _this.filterFrame = null; /** * The key for pooled texture of FilterSystem * @protected * @member {string} */ - this.filterPoolKey = null; - - this.updateUvs(); + _this.filterPoolKey = null; + _this.updateUvs(); + return _this; } - - if ( Texture ) { RenderTexture.__proto__ = Texture; } - RenderTexture.prototype = Object.create( Texture && Texture.prototype ); - RenderTexture.prototype.constructor = RenderTexture; - + Object.defineProperty(RenderTexture.prototype, "framebuffer", { + /** + * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast. + * @member {PIXI.Framebuffer} + * @readonly + */ + get: function () { + return this.baseTexture.framebuffer; + }, + enumerable: false, + configurable: true + }); /** * Resizes the RenderTexture. * @@ -21163,46 +19979,32 @@ var PIXI = (function (exports) { * @param {number} height - The height to resize to. * @param {boolean} [resizeBaseTexture=true] - Should the baseTexture.width and height values be resized as well? */ - RenderTexture.prototype.resize = function resize (width, height, resizeBaseTexture) - { - if ( resizeBaseTexture === void 0 ) { resizeBaseTexture = true; } - + RenderTexture.prototype.resize = function (width, height, resizeBaseTexture) { + if (resizeBaseTexture === void 0) { resizeBaseTexture = true; } width = Math.ceil(width); height = Math.ceil(height); - // TODO - could be not required.. this.valid = (width > 0 && height > 0); - this._frame.width = this.orig.width = width; this._frame.height = this.orig.height = height; - - if (resizeBaseTexture) - { + if (resizeBaseTexture) { this.baseTexture.resize(width, height); } - this.updateUvs(); }; - /** * Changes the resolution of baseTexture, but does not change framebuffer size. * * @param {number} resolution - The new resolution to apply to RenderTexture */ - RenderTexture.prototype.setResolution = function setResolution (resolution) - { - var ref = this; - var baseTexture = ref.baseTexture; - - if (baseTexture.resolution === resolution) - { + RenderTexture.prototype.setResolution = function (resolution) { + var baseTexture = this.baseTexture; + if (baseTexture.resolution === resolution) { return; } - baseTexture.setResolution(resolution); this.resize(baseTexture.width, baseTexture.height, false); }; - /** * A short hand way of creating a render texture. * @@ -21213,11 +20015,9 @@ var PIXI = (function (exports) { * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the texture being generated * @return {PIXI.RenderTexture} The new render texture */ - RenderTexture.create = function create (options) - { + RenderTexture.create = function (options) { // fallback, old-style: create(width, height, scaleMode, resolution) - if (typeof options === 'number') - { + if (typeof options === 'number') { /* eslint-disable prefer-rest-params */ options = { width: options, @@ -21227,10 +20027,8 @@ var PIXI = (function (exports) { }; /* eslint-enable prefer-rest-params */ } - return new RenderTexture(new BaseRenderTexture(options)); }; - return RenderTexture; }(Texture)); @@ -21246,196 +20044,157 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var RenderTexturePool = function RenderTexturePool(textureOptions) - { - this.texturePool = {}; - this.textureOptions = textureOptions || {}; + var RenderTexturePool = /** @class */ (function () { /** - * Allow renderTextures of the same size as screen, not just pow2 - * - * Automatically sets to true after `setScreenSize` - * - * @member {boolean} - * @default false + * @param {object} [textureOptions] - options that will be passed to BaseRenderTexture constructor + * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values. */ - this.enableFullScreen = false; - - this._pixelsWidth = 0; - this._pixelsHeight = 0; - }; - - /** - * creates of texture with params that were specified in pool constructor - * - * @param {number} realWidth width of texture in pixels - * @param {number} realHeight height of texture in pixels - * @returns {RenderTexture} - */ - RenderTexturePool.prototype.createTexture = function createTexture (realWidth, realHeight) - { - var baseRenderTexture = new BaseRenderTexture(Object.assign({ - width: realWidth, - height: realHeight, - resolution: 1, - }, this.textureOptions)); - - return new RenderTexture(baseRenderTexture); - }; - - /** - * Gets a Power-of-Two render texture or fullScreen texture - * - * @protected - * @param {number} minWidth - The minimum width of the render texture in real pixels. - * @param {number} minHeight - The minimum height of the render texture in real pixels. - * @param {number} [resolution=1] - The resolution of the render texture. - * @return {PIXI.RenderTexture} The new render texture. - */ - RenderTexturePool.prototype.getOptimalTexture = function getOptimalTexture (minWidth, minHeight, resolution) - { - if ( resolution === void 0 ) { resolution = 1; } - - var key = RenderTexturePool.SCREEN_KEY; - - minWidth *= resolution; - minHeight *= resolution; - - if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) - { - minWidth = nextPow2(minWidth); - minHeight = nextPow2(minHeight); - key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF); + function RenderTexturePool(textureOptions) { + this.texturePool = {}; + this.textureOptions = textureOptions || {}; + /** + * Allow renderTextures of the same size as screen, not just pow2 + * + * Automatically sets to true after `setScreenSize` + * + * @member {boolean} + * @default false + */ + this.enableFullScreen = false; + this._pixelsWidth = 0; + this._pixelsHeight = 0; } - - if (!this.texturePool[key]) - { - this.texturePool[key] = []; - } - - var renderTexture = this.texturePool[key].pop(); - - if (!renderTexture) - { - renderTexture = this.createTexture(minWidth, minHeight); - } - - renderTexture.filterPoolKey = key; - renderTexture.setResolution(resolution); - - return renderTexture; - }; - - /** - * Gets extra texture of the same size as input renderTexture - * - * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` - * - * @param {PIXI.RenderTexture} input renderTexture from which size and resolution will be copied - * @param {number} [resolution] override resolution of the renderTexture - * It overrides, it does not multiply - * @returns {PIXI.RenderTexture} - */ - RenderTexturePool.prototype.getFilterTexture = function getFilterTexture (input, resolution) - { - var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution); - - filterTexture.filterFrame = input.filterFrame; - - return filterTexture; - }; - - /** - * Place a render texture back into the pool. - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnTexture = function returnTexture (renderTexture) - { - var key = renderTexture.filterPoolKey; - - renderTexture.filterFrame = null; - this.texturePool[key].push(renderTexture); - }; - - /** - * Alias for returnTexture, to be compliant with FilterSystem interface - * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free - */ - RenderTexturePool.prototype.returnFilterTexture = function returnFilterTexture (renderTexture) - { - this.returnTexture(renderTexture); - }; - - /** - * Clears the pool - * - * @param {boolean} [destroyTextures=true] destroy all stored textures - */ - RenderTexturePool.prototype.clear = function clear (destroyTextures) - { - destroyTextures = destroyTextures !== false; - if (destroyTextures) - { - for (var i in this.texturePool) - { - var textures = this.texturePool[i]; - - if (textures) - { - for (var j = 0; j < textures.length; j++) - { - textures[j].destroy(true); + /** + * creates of texture with params that were specified in pool constructor + * + * @param {number} realWidth - width of texture in pixels + * @param {number} realHeight - height of texture in pixels + * @returns {RenderTexture} + */ + RenderTexturePool.prototype.createTexture = function (realWidth, realHeight) { + var baseRenderTexture = new BaseRenderTexture(Object.assign({ + width: realWidth, + height: realHeight, + resolution: 1, + }, this.textureOptions)); + return new RenderTexture(baseRenderTexture); + }; + /** + * Gets a Power-of-Two render texture or fullScreen texture + * + * @protected + * @param {number} minWidth - The minimum width of the render texture in real pixels. + * @param {number} minHeight - The minimum height of the render texture in real pixels. + * @param {number} [resolution=1] - The resolution of the render texture. + * @return {PIXI.RenderTexture} The new render texture. + */ + RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution) { + if (resolution === void 0) { resolution = 1; } + var key = RenderTexturePool.SCREEN_KEY; + minWidth *= resolution; + minHeight *= resolution; + if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) { + minWidth = nextPow2(minWidth); + minHeight = nextPow2(minHeight); + key = ((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF); + } + if (!this.texturePool[key]) { + this.texturePool[key] = []; + } + var renderTexture = this.texturePool[key].pop(); + if (!renderTexture) { + renderTexture = this.createTexture(minWidth, minHeight); + } + renderTexture.filterPoolKey = key; + renderTexture.setResolution(resolution); + return renderTexture; + }; + /** + * Gets extra texture of the same size as input renderTexture + * + * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)` + * + * @param {PIXI.RenderTexture} input - renderTexture from which size and resolution will be copied + * @param {number} [resolution] - override resolution of the renderTexture + * It overrides, it does not multiply + * @returns {PIXI.RenderTexture} + */ + RenderTexturePool.prototype.getFilterTexture = function (input, resolution) { + var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution); + filterTexture.filterFrame = input.filterFrame; + return filterTexture; + }; + /** + * Place a render texture back into the pool. + * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnTexture = function (renderTexture) { + var key = renderTexture.filterPoolKey; + renderTexture.filterFrame = null; + this.texturePool[key].push(renderTexture); + }; + /** + * Alias for returnTexture, to be compliant with FilterSystem interface + * @param {PIXI.RenderTexture} renderTexture - The renderTexture to free + */ + RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) { + this.returnTexture(renderTexture); + }; + /** + * Clears the pool + * + * @param {boolean} [destroyTextures=true] - destroy all stored textures + */ + RenderTexturePool.prototype.clear = function (destroyTextures) { + destroyTextures = destroyTextures !== false; + if (destroyTextures) { + for (var i in this.texturePool) { + var textures = this.texturePool[i]; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } } } } - } - - this.texturePool = {}; - }; - - /** - * If screen size was changed, drops all screen-sized textures, - * sets new screen size, sets `enableFullScreen` to true - * - * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` - * - * @param {PIXI.ISize} size - Initial size of screen - */ - RenderTexturePool.prototype.setScreenSize = function setScreenSize (size) - { - if (size.width === this._pixelsWidth - && size.height === this._pixelsHeight) - { - return; - } - - var screenKey = RenderTexturePool.SCREEN_KEY; - var textures = this.texturePool[screenKey]; - - this.enableFullScreen = size.width > 0 && size.height > 0; - - if (textures) - { - for (var j = 0; j < textures.length; j++) - { - textures[j].destroy(true); + this.texturePool = {}; + }; + /** + * If screen size was changed, drops all screen-sized textures, + * sets new screen size, sets `enableFullScreen` to true + * + * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen` + * + * @param {PIXI.ISize} size - Initial size of screen + */ + RenderTexturePool.prototype.setScreenSize = function (size) { + if (size.width === this._pixelsWidth + && size.height === this._pixelsHeight) { + return; } - } - this.texturePool[screenKey] = []; - - this._pixelsWidth = size.width; - this._pixelsHeight = size.height; - }; - - /** - * Key that is used to store fullscreen renderTextures in a pool - * - * @static - * @const {string} - */ - RenderTexturePool.SCREEN_KEY = 'screen'; + var screenKey = RenderTexturePool.SCREEN_KEY; + var textures = this.texturePool[screenKey]; + this.enableFullScreen = size.width > 0 && size.height > 0; + if (textures) { + for (var j = 0; j < textures.length; j++) { + textures[j].destroy(true); + } + } + this.texturePool[screenKey] = []; + this._pixelsWidth = size.width; + this._pixelsHeight = size.height; + }; + /** + * Key that is used to store fullscreen renderTextures in a pool + * + * @static + * @const {string} + */ + RenderTexturePool.SCREEN_KEY = 'screen'; + return RenderTexturePool; + }()); /* eslint-disable max-len */ - /** * Holds the information for a single attribute structure required to render geometry. * @@ -21445,162 +20204,144 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Attribute = function Attribute(buffer, size, normalized, type, stride, start, instance) - { - if ( normalized === void 0 ) { normalized = false; } - if ( type === void 0 ) { type = 5126; } - - this.buffer = buffer; - this.size = size; - this.normalized = normalized; - this.type = type; - this.stride = stride; - this.start = start; - this.instance = instance; - }; - - /** - * Destroys the Attribute. - */ - Attribute.prototype.destroy = function destroy () - { - this.buffer = null; - }; - - /** - * Helper function that creates an Attribute based on the information provided - * - * @static - * @param {string} buffer the id of the buffer that this attribute will look for - * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] should the data be normalized. - * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) - * - * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided - */ - Attribute.from = function from (buffer, size, normalized, type, stride) - { - return new Attribute(buffer, size, normalized, type, stride); - }; + var Attribute = /** @class */ (function () { + /** + * @param {string} buffer - the id of the buffer that this attribute will look for + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2. + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start=0] - How far into the array to start reading values (used for interleaving data) + */ + function Attribute(buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (type === void 0) { type = 5126; } + this.buffer = buffer; + this.size = size; + this.normalized = normalized; + this.type = type; + this.stride = stride; + this.start = start; + this.instance = instance; + } + /** + * Destroys the Attribute. + */ + Attribute.prototype.destroy = function () { + this.buffer = null; + }; + /** + * Helper function that creates an Attribute based on the information provided + * + * @static + * @param {string} buffer - the id of the buffer that this attribute will look for + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available + * @param {Number} [stride=0] - How far apart (in floats) the start of each value is. (used for interleaving data) + * + * @returns {PIXI.Attribute} A new {@link PIXI.Attribute} based on the information provided + */ + Attribute.from = function (buffer, size, normalized, type, stride) { + return new Attribute(buffer, size, normalized, type, stride); + }; + return Attribute; + }()); var UID = 0; - /* eslint-disable max-len */ - /** * A wrapper for data so that it can be used and uploaded by WebGL * * @class * @memberof PIXI */ - var Buffer = function Buffer(data, _static, index) - { - if ( _static === void 0 ) { _static = true; } - if ( index === void 0 ) { index = false; } - + var Buffer = /** @class */ (function () { /** - * The data in the buffer, as a typed array - * - * @member {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} + * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer. + * @param {boolean} [_static=true] - `true` for static buffer + * @param {boolean} [index=false] - `true` for index buffer */ - this.data = data || new Float32Array(1); - - /** - * A map of renderer IDs to webgl buffer - * - * @private - * @member {object} - */ - this._glBuffers = {}; - - this._updateID = 0; - - this.index = index; - - this.static = _static; - - this.id = UID++; - - this.disposeRunner = new Runner('disposeBuffer', 2); - }; - - // TODO could explore flagging only a partial upload? - /** - * flags this buffer as requiring an upload to the GPU - * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] the data to update in the buffer. - */ - Buffer.prototype.update = function update (data) - { - this.data = data || this.data; - this._updateID++; - }; - - /** - * disposes WebGL resources that are connected to this geometry - */ - Buffer.prototype.dispose = function dispose () - { - this.disposeRunner.run(this, false); - }; - - /** - * Destroys the buffer - */ - Buffer.prototype.destroy = function destroy () - { - this.dispose(); - - this.data = null; - }; - - /** - * Helper function that creates a buffer based on an array or TypedArray - * - * @static - * @param {ArrayBufferView | number[]} data the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. - * @return {PIXI.Buffer} A new Buffer based on the data provided. - */ - Buffer.from = function from (data) - { - if (data instanceof Array) - { - data = new Float32Array(data); + function Buffer(data, _static, index) { + if (_static === void 0) { _static = true; } + if (index === void 0) { index = false; } + /** + * The data in the buffer, as a typed array + * + * @member {ArrayBuffer| SharedArrayBuffer | ArrayBufferView} + */ + this.data = (data || new Float32Array(1)); + /** + * A map of renderer IDs to webgl buffer + * + * @private + * @member {object} + */ + this._glBuffers = {}; + this._updateID = 0; + this.index = index; + this.static = _static; + this.id = UID++; + this.disposeRunner = new Runner('disposeBuffer'); } + // TODO could explore flagging only a partial upload? + /** + * flags this buffer as requiring an upload to the GPU + * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView} [data] - the data to update in the buffer. + */ + Buffer.prototype.update = function (data) { + this.data = data || this.data; + this._updateID++; + }; + /** + * disposes WebGL resources that are connected to this geometry + */ + Buffer.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys the buffer + */ + Buffer.prototype.destroy = function () { + this.dispose(); + this.data = null; + }; + /** + * Helper function that creates a buffer based on an array or TypedArray + * + * @static + * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array. + * @return {PIXI.Buffer} A new Buffer based on the data provided. + */ + Buffer.from = function (data) { + if (data instanceof Array) { + data = new Float32Array(data); + } + return new Buffer(data); + }; + return Buffer; + }()); - return new Buffer(data); - }; - - function getBufferType$1(array) - { - if (array.BYTES_PER_ELEMENT === 4) - { - if (array instanceof Float32Array) - { + function getBufferType$1(array) { + if (array.BYTES_PER_ELEMENT === 4) { + if (array instanceof Float32Array) { return 'Float32Array'; } - else if (array instanceof Uint32Array) - { + else if (array instanceof Uint32Array) { return 'Uint32Array'; } - return 'Int32Array'; } - else if (array.BYTES_PER_ELEMENT === 2) - { - if (array instanceof Uint16Array) - { + else if (array.BYTES_PER_ELEMENT === 2) { + if (array instanceof Uint16Array) { return 'Uint16Array'; } } - else if (array.BYTES_PER_ELEMENT === 1) - { - if (array instanceof Uint8Array) - { + else if (array.BYTES_PER_ELEMENT === 1) { + if (array instanceof Uint8Array) { return 'Uint8Array'; } } - // TODO map out the rest of the array elements! return null; } @@ -21612,55 +20353,37 @@ var PIXI = (function (exports) { Int32Array: Int32Array, Uint8Array: Uint8Array, }; - - function interleaveTypedArrays$1(arrays, sizes) - { + function interleaveTypedArrays$1(arrays, sizes) { var outSize = 0; var stride = 0; var views = {}; - - for (var i = 0; i < arrays.length; i++) - { + for (var i = 0; i < arrays.length; i++) { stride += sizes[i]; outSize += arrays[i].length; } - var buffer = new ArrayBuffer(outSize * 4); - var out = null; var littleOffset = 0; - - for (var i$1 = 0; i$1 < arrays.length; i$1++) - { - var size = sizes[i$1]; - var array = arrays[i$1]; - + for (var i = 0; i < arrays.length; i++) { + var size = sizes[i]; + var array = arrays[i]; var type = getBufferType$1(array); - - if (!views[type]) - { + if (!views[type]) { views[type] = new map$1[type](buffer); } - out = views[type]; - - for (var j = 0; j < array.length; j++) - { + for (var j = 0; j < array.length; j++) { var indexStart = ((j / size | 0) * stride) + littleOffset; var index = j % size; - out[indexStart + index] = array[j]; } - littleOffset += size; } - return new Float32Array(buffer); } var byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 }; var UID$1 = 0; - /* eslint-disable object-shorthand */ var map$1$1 = { Float32Array: Float32Array, @@ -21669,9 +20392,7 @@ var PIXI = (function (exports) { Uint8Array: Uint8Array, Uint16Array: Uint16Array, }; - /* eslint-disable max-len */ - /** * The Geometry represents a model. It consists of two components: * - GeometryStyle - The structure of the model such as the attributes layout @@ -21691,397 +20412,287 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Geometry = function Geometry(buffers, attributes) - { - if ( buffers === void 0 ) { buffers = []; } - if ( attributes === void 0 ) { attributes = {}; } - - this.buffers = buffers; - - this.indexBuffer = null; - - this.attributes = attributes; - + var Geometry = /** @class */ (function () { /** - * A map of renderer IDs to webgl VAOs - * - * @protected - * @type {object} + * @param {PIXI.Buffer[]} [buffers] - an array of buffers. optional. + * @param {object} [attributes] - of the geometry, optional structure of the attributes layout */ - this.glVertexArrayObjects = {}; - - this.id = UID$1++; - - this.instanced = false; - - /** - * Number of instances in this geometry, pass it to `GeometrySystem.draw()` - * @member {number} - * @default 1 - */ - this.instanceCount = 1; - - this.disposeRunner = new Runner('disposeGeometry', 2); - - /** - * Count of existing (not destroyed) meshes that reference this geometry - * @member {number} - */ - this.refCount = 0; - }; - - /** - * - * Adds an attribute to the geometry - * - * @param {String} id - the name of the attribute (matching up to a shader) - * @param {PIXI.Buffer|number[]} [buffer] the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. - * @param {Number} [size=0] the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 - * @param {Boolean} [normalized=false] should the data be normalized. - * @param {Number} [type=PIXI.TYPES.FLOAT] what type of number is the attribute. Check {PIXI.TYPES} to see the ones available - * @param {Number} [stride=0] How far apart (in floats) the start of each value is. (used for interleaving data) - * @param {Number} [start=0] How far into the array to start reading values (used for interleaving data) - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addAttribute = function addAttribute (id, buffer, size, normalized, type, stride, start, instance) - { - if ( normalized === void 0 ) { normalized = false; } - if ( instance === void 0 ) { instance = false; } - - if (!buffer) - { - throw new Error('You must pass a buffer when creating an attribute'); + function Geometry(buffers, attributes) { + if (buffers === void 0) { buffers = []; } + if (attributes === void 0) { attributes = {}; } + this.buffers = buffers; + this.indexBuffer = null; + this.attributes = attributes; + /** + * A map of renderer IDs to webgl VAOs + * + * @protected + * @type {object} + */ + this.glVertexArrayObjects = {}; + this.id = UID$1++; + this.instanced = false; + /** + * Number of instances in this geometry, pass it to `GeometrySystem.draw()` + * @member {number} + * @default 1 + */ + this.instanceCount = 1; + this.disposeRunner = new Runner('disposeGeometry'); + /** + * Count of existing (not destroyed) meshes that reference this geometry + * @member {number} + */ + this.refCount = 0; } - - // check if this is a buffer! - if (!buffer.data) - { - // its an array! - if (buffer instanceof Array) - { - buffer = new Float32Array(buffer); + /** + * + * Adds an attribute to the geometry + * Note: `stride` and `start` should be `undefined` if you dont know them, not 0! + * + * @param {String} id - the name of the attribute (matching up to a shader) + * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it. + * @param {Number} [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2 + * @param {Boolean} [normalized=false] - should the data be normalized. + * @param {Number} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available + * @param {Number} [stride] - How far apart (in floats) the start of each value is. (used for interleaving data) + * @param {Number} [start] - How far into the array to start reading values (used for interleaving data) + * @param {boolean} [instance=false] - Instancing flag + * + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) { + if (size === void 0) { size = 0; } + if (normalized === void 0) { normalized = false; } + if (instance === void 0) { instance = false; } + if (!buffer) { + throw new Error('You must pass a buffer when creating an attribute'); } - - buffer = new Buffer(buffer); - } - - var ids = id.split('|'); - - if (ids.length > 1) - { - for (var i = 0; i < ids.length; i++) - { - this.addAttribute(ids[i], buffer, size, normalized, type); + // check if this is a buffer! + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Float32Array(buffer); + } + buffer = new Buffer(buffer); } - + var ids = id.split('|'); + if (ids.length > 1) { + for (var i = 0; i < ids.length; i++) { + this.addAttribute(ids[i], buffer, size, normalized, type); + } + return this; + } + var bufferIndex = this.buffers.indexOf(buffer); + if (bufferIndex === -1) { + this.buffers.push(buffer); + bufferIndex = this.buffers.length - 1; + } + this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); + // assuming that if there is instanced data then this will be drawn with instancing! + this.instanced = this.instanced || instance; return this; - } - - var bufferIndex = this.buffers.indexOf(buffer); - - if (bufferIndex === -1) - { - this.buffers.push(buffer); - bufferIndex = this.buffers.length - 1; - } - - this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance); - - // assuming that if there is instanced data then this will be drawn with instancing! - this.instanced = this.instanced || instance; - - return this; - }; - - /** - * returns the requested attribute - * - * @param {String} id the name of the attribute required - * @return {PIXI.Attribute} the attribute requested. - */ - Geometry.prototype.getAttribute = function getAttribute (id) - { - return this.attributes[id]; - }; - - /** - * returns the requested buffer - * - * @param {String} id the name of the buffer required - * @return {PIXI.Buffer} the buffer requested. - */ - Geometry.prototype.getBuffer = function getBuffer (id) - { - return this.buffers[this.getAttribute(id).buffer]; - }; - - /** - * - * Adds an index buffer to the geometry - * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. - * - * @param {PIXI.Buffer|number[]} [buffer] the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.addIndex = function addIndex (buffer) - { - if (!buffer.data) - { - // its an array! - if (buffer instanceof Array) - { - buffer = new Uint16Array(buffer); + }; + /** + * returns the requested attribute + * + * @param {String} id - the name of the attribute required + * @return {PIXI.Attribute} the attribute requested. + */ + Geometry.prototype.getAttribute = function (id) { + return this.attributes[id]; + }; + /** + * returns the requested buffer + * + * @param {String} id - the name of the buffer required + * @return {PIXI.Buffer} the buffer requested. + */ + Geometry.prototype.getBuffer = function (id) { + return this.buffers[this.getAttribute(id).buffer]; + }; + /** + * + * Adds an index buffer to the geometry + * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer. + * + * @param {PIXI.Buffer|number[]} [buffer] - the buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it. + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.addIndex = function (buffer) { + if (!(buffer instanceof Buffer)) { + // its an array! + if (buffer instanceof Array) { + buffer = new Uint16Array(buffer); + } + buffer = new Buffer(buffer); } - - buffer = new Buffer(buffer); - } - - buffer.index = true; - this.indexBuffer = buffer; - - if (this.buffers.indexOf(buffer) === -1) - { - this.buffers.push(buffer); - } - - return this; - }; - - /** - * returns the index buffer - * - * @return {PIXI.Buffer} the index buffer. - */ - Geometry.prototype.getIndex = function getIndex () - { - return this.indexBuffer; - }; - - /** - * this function modifies the structure so that all current attributes become interleaved into a single buffer - * This can be useful if your model remains static as it offers a little performance boost - * - * @return {PIXI.Geometry} returns self, useful for chaining. - */ - Geometry.prototype.interleave = function interleave () - { - // a simple check to see if buffers are already interleaved.. - if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) { return this; } - - // assume already that no buffers are interleaved - var arrays = []; - var sizes = []; - var interleavedBuffer = new Buffer(); - var i; - - for (i in this.attributes) - { - var attribute = this.attributes[i]; - - var buffer = this.buffers[attribute.buffer]; - - arrays.push(buffer.data); - - sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4); - - attribute.buffer = 0; - } - - interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); - - for (i = 0; i < this.buffers.length; i++) - { - if (this.buffers[i] !== this.indexBuffer) - { - this.buffers[i].destroy(); + buffer.index = true; + this.indexBuffer = buffer; + if (this.buffers.indexOf(buffer) === -1) { + this.buffers.push(buffer); } - } - - this.buffers = [interleavedBuffer]; - - if (this.indexBuffer) - { - this.buffers.push(this.indexBuffer); - } - - return this; - }; - - Geometry.prototype.getSize = function getSize () - { - for (var i in this.attributes) - { - var attribute = this.attributes[i]; - var buffer = this.buffers[attribute.buffer]; - - return buffer.data.length / ((attribute.stride / 4) || attribute.size); - } - - return 0; - }; - - /** - * disposes WebGL resources that are connected to this geometry - */ - Geometry.prototype.dispose = function dispose () - { - this.disposeRunner.run(this, false); - }; - - /** - * Destroys the geometry. - */ - Geometry.prototype.destroy = function destroy () - { - this.dispose(); - - this.buffers = null; - this.indexBuffer = null; - this.attributes = null; - }; - - /** - * returns a clone of the geometry - * - * @returns {PIXI.Geometry} a new clone of this geometry - */ - Geometry.prototype.clone = function clone () - { - var geometry = new Geometry(); - - for (var i = 0; i < this.buffers.length; i++) - { - geometry.buffers[i] = new Buffer(this.buffers[i].data.slice()); - } - - for (var i$1 in this.attributes) - { - var attrib = this.attributes[i$1]; - - geometry.attributes[i$1] = new Attribute( - attrib.buffer, - attrib.size, - attrib.normalized, - attrib.type, - attrib.stride, - attrib.start, - attrib.instance - ); - } - - if (this.indexBuffer) - { - geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; - geometry.indexBuffer.index = true; - } - - return geometry; - }; - - /** - * merges an array of geometries into a new single one - * geometry attribute styles must match for this operation to work - * - * @param {PIXI.Geometry[]} geometries array of geometries to merge - * @returns {PIXI.Geometry} shiny new geometry! - */ - Geometry.merge = function merge (geometries) - { - // todo add a geometry check! - // also a size check.. cant be too big!] - - var geometryOut = new Geometry(); - - var arrays = []; - var sizes = []; - var offsets = []; - - var geometry; - - // pass one.. get sizes.. - for (var i = 0; i < geometries.length; i++) - { - geometry = geometries[i]; - - for (var j = 0; j < geometry.buffers.length; j++) - { - sizes[j] = sizes[j] || 0; - sizes[j] += geometry.buffers[j].data.length; - offsets[j] = 0; + return this; + }; + /** + * returns the index buffer + * + * @return {PIXI.Buffer} the index buffer. + */ + Geometry.prototype.getIndex = function () { + return this.indexBuffer; + }; + /** + * this function modifies the structure so that all current attributes become interleaved into a single buffer + * This can be useful if your model remains static as it offers a little performance boost + * + * @return {PIXI.Geometry} returns self, useful for chaining. + */ + Geometry.prototype.interleave = function () { + // a simple check to see if buffers are already interleaved.. + if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) + { return this; } + // assume already that no buffers are interleaved + var arrays = []; + var sizes = []; + var interleavedBuffer = new Buffer(); + var i; + for (i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + arrays.push(buffer.data); + sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4); + attribute.buffer = 0; } - } - - // build the correct size arrays.. - for (var i$1 = 0; i$1 < geometry.buffers.length; i$1++) - { - // TODO types! - arrays[i$1] = new map$1$1[getBufferType$1(geometry.buffers[i$1].data)](sizes[i$1]); - geometryOut.buffers[i$1] = new Buffer(arrays[i$1]); - } - - // pass to set data.. - for (var i$2 = 0; i$2 < geometries.length; i$2++) - { - geometry = geometries[i$2]; - - for (var j$1 = 0; j$1 < geometry.buffers.length; j$1++) - { - arrays[j$1].set(geometry.buffers[j$1].data, offsets[j$1]); - offsets[j$1] += geometry.buffers[j$1].data.length; - } - } - - geometryOut.attributes = geometry.attributes; - - if (geometry.indexBuffer) - { - geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; - geometryOut.indexBuffer.index = true; - - var offset = 0; - var stride = 0; - var offset2 = 0; - var bufferIndexToCount = 0; - - // get a buffer - for (var i$3 = 0; i$3 < geometry.buffers.length; i$3++) - { - if (geometry.buffers[i$3] !== geometry.indexBuffer) - { - bufferIndexToCount = i$3; - break; + interleavedBuffer.data = interleaveTypedArrays$1(arrays, sizes); + for (i = 0; i < this.buffers.length; i++) { + if (this.buffers[i] !== this.indexBuffer) { + this.buffers[i].destroy(); } } - - // figure out the stride of one buffer.. - for (var i$4 in geometry.attributes) - { - var attribute = geometry.attributes[i$4]; - - if ((attribute.buffer | 0) === bufferIndexToCount) - { - stride += ((attribute.size * byteSizeMap[attribute.type]) / 4); + this.buffers = [interleavedBuffer]; + if (this.indexBuffer) { + this.buffers.push(this.indexBuffer); + } + return this; + }; + Geometry.prototype.getSize = function () { + for (var i in this.attributes) { + var attribute = this.attributes[i]; + var buffer = this.buffers[attribute.buffer]; + return buffer.data.length / ((attribute.stride / 4) || attribute.size); + } + return 0; + }; + /** + * disposes WebGL resources that are connected to this geometry + */ + Geometry.prototype.dispose = function () { + this.disposeRunner.emit(this, false); + }; + /** + * Destroys the geometry. + */ + Geometry.prototype.destroy = function () { + this.dispose(); + this.buffers = null; + this.indexBuffer = null; + this.attributes = null; + }; + /** + * returns a clone of the geometry + * + * @returns {PIXI.Geometry} a new clone of this geometry + */ + Geometry.prototype.clone = function () { + var geometry = new Geometry(); + for (var i = 0; i < this.buffers.length; i++) { + geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0)); + } + for (var i in this.attributes) { + var attrib = this.attributes[i]; + geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance); + } + if (this.indexBuffer) { + geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)]; + geometry.indexBuffer.index = true; + } + return geometry; + }; + /** + * merges an array of geometries into a new single one + * geometry attribute styles must match for this operation to work + * + * @param {PIXI.Geometry[]} geometries - array of geometries to merge + * @returns {PIXI.Geometry} shiny new geometry! + */ + Geometry.merge = function (geometries) { + // todo add a geometry check! + // also a size check.. cant be too big!] + var geometryOut = new Geometry(); + var arrays = []; + var sizes = []; + var offsets = []; + var geometry; + // pass one.. get sizes.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + sizes[j] = sizes[j] || 0; + sizes[j] += geometry.buffers[j].data.length; + offsets[j] = 0; } } - - // time to off set all indexes.. - for (var i$5 = 0; i$5 < geometries.length; i$5++) - { - var indexBufferData = geometries[i$5].indexBuffer.data; - - for (var j$2 = 0; j$2 < indexBufferData.length; j$2++) - { - geometryOut.indexBuffer.data[j$2 + offset2] += offset; - } - - offset += geometry.buffers[bufferIndexToCount].data.length / (stride); - offset2 += indexBufferData.length; + // build the correct size arrays.. + for (var i = 0; i < geometry.buffers.length; i++) { + // TODO types! + arrays[i] = new map$1$1[getBufferType$1(geometry.buffers[i].data)](sizes[i]); + geometryOut.buffers[i] = new Buffer(arrays[i]); } - } - - return geometryOut; - }; + // pass to set data.. + for (var i = 0; i < geometries.length; i++) { + geometry = geometries[i]; + for (var j = 0; j < geometry.buffers.length; j++) { + arrays[j].set(geometry.buffers[j].data, offsets[j]); + offsets[j] += geometry.buffers[j].data.length; + } + } + geometryOut.attributes = geometry.attributes; + if (geometry.indexBuffer) { + geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)]; + geometryOut.indexBuffer.index = true; + var offset = 0; + var stride = 0; + var offset2 = 0; + var bufferIndexToCount = 0; + // get a buffer + for (var i = 0; i < geometry.buffers.length; i++) { + if (geometry.buffers[i] !== geometry.indexBuffer) { + bufferIndexToCount = i; + break; + } + } + // figure out the stride of one buffer.. + for (var i in geometry.attributes) { + var attribute = geometry.attributes[i]; + if ((attribute.buffer | 0) === bufferIndexToCount) { + stride += ((attribute.size * byteSizeMap[attribute.type]) / 4); + } + } + // time to off set all indexes.. + for (var i = 0; i < geometries.length; i++) { + var indexBufferData = geometries[i].indexBuffer.data; + for (var j = 0; j < indexBufferData.length; j++) { + geometryOut.indexBuffer.data[j + offset2] += offset; + } + offset += geometry.buffers[bufferIndexToCount].data.length / (stride); + offset2 += indexBufferData.length; + } + } + return geometryOut; + }; + return Geometry; + }()); /** * Helper class to create a quad @@ -22089,23 +20700,18 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Quad = /*@__PURE__*/(function (Geometry) { - function Quad() - { - Geometry.call(this); - - this.addAttribute('aVertexPosition', [ + var Quad = /** @class */ (function (_super) { + __extends$2(Quad, _super); + function Quad() { + var _this = _super.call(this) || this; + _this.addAttribute('aVertexPosition', new Float32Array([ 0, 0, 1, 0, 1, 1, - 0, 1 ]) + 0, 1 ])) .addIndex([0, 1, 3, 2]); + return _this; } - - if ( Geometry ) { Quad.__proto__ = Geometry; } - Quad.prototype = Object.create( Geometry && Geometry.prototype ); - Quad.prototype.constructor = Quad; - return Quad; }(Geometry)); @@ -22116,45 +20722,37 @@ var PIXI = (function (exports) { * @memberof PIXI * @extends PIXI.Geometry */ - var QuadUv = /*@__PURE__*/(function (Geometry) { - function QuadUv() - { - Geometry.call(this); - + var QuadUv = /** @class */ (function (_super) { + __extends$2(QuadUv, _super); + function QuadUv() { + var _this = _super.call(this) || this; /** * An array of vertices * * @member {Float32Array} */ - this.vertices = new Float32Array([ + _this.vertices = new Float32Array([ -1, -1, 1, -1, 1, 1, -1, 1 ]); - /** * The Uvs of the quad * * @member {Float32Array} */ - this.uvs = new Float32Array([ + _this.uvs = new Float32Array([ 0, 0, 1, 0, 1, 1, 0, 1 ]); - - this.vertexBuffer = new Buffer(this.vertices); - this.uvBuffer = new Buffer(this.uvs); - - this.addAttribute('aVertexPosition', this.vertexBuffer) - .addAttribute('aTextureCoord', this.uvBuffer) + _this.vertexBuffer = new Buffer(_this.vertices); + _this.uvBuffer = new Buffer(_this.uvs); + _this.addAttribute('aVertexPosition', _this.vertexBuffer) + .addAttribute('aTextureCoord', _this.uvBuffer) .addIndex([0, 1, 2, 0, 2, 3]); + return _this; } - - if ( Geometry ) { QuadUv.__proto__ = Geometry; } - QuadUv.prototype = Object.create( Geometry && Geometry.prototype ); - QuadUv.prototype.constructor = QuadUv; - /** * Maps two Rectangle to the quad. * @@ -22162,121 +20760,99 @@ var PIXI = (function (exports) { * @param {PIXI.Rectangle} destinationFrame - the second rectangle * @return {PIXI.Quad} Returns itself. */ - QuadUv.prototype.map = function map (targetTextureFrame, destinationFrame) - { + QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) { var x = 0; // destinationFrame.x / targetTextureFrame.width; var y = 0; // destinationFrame.y / targetTextureFrame.height; - this.uvs[0] = x; this.uvs[1] = y; - this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width); this.uvs[3] = y; - this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width); this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height); - this.uvs[6] = x; this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height); - x = destinationFrame.x; y = destinationFrame.y; - this.vertices[0] = x; this.vertices[1] = y; - this.vertices[2] = x + destinationFrame.width; this.vertices[3] = y; - this.vertices[4] = x + destinationFrame.width; this.vertices[5] = y + destinationFrame.height; - this.vertices[6] = x; this.vertices[7] = y + destinationFrame.height; - this.invalidate(); - return this; }; - /** * legacy upload method, just marks buffers dirty * @returns {PIXI.QuadUv} Returns itself. */ - QuadUv.prototype.invalidate = function invalidate () - { + QuadUv.prototype.invalidate = function () { this.vertexBuffer._updateID++; this.uvBuffer._updateID++; - return this; }; - return QuadUv; }(Geometry)); var UID$2 = 0; - /** * Uniform group holds uniform map and some ID's for work * * @class * @memberof PIXI */ - var UniformGroup = function UniformGroup(uniforms, _static) - { + var UniformGroup = /** @class */ (function () { /** - * uniform values - * @member {object} - * @readonly + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * @param {boolean} [_static] - Uniforms wont be changed after creation */ - this.uniforms = uniforms; - - /** - * Its a group and not a single uniforms - * @member {boolean} - * @readonly - * @default true - */ - this.group = true; - - // lets generate this when the shader ? - this.syncUniforms = {}; - - /** - * dirty version - * @protected - * @member {number} - */ - this.dirtyId = 0; - - /** - * unique id - * @protected - * @member {number} - */ - this.id = UID$2++; - - /** - * Uniforms wont be changed after creation - * @member {boolean} - */ - this.static = !!_static; - }; - - UniformGroup.prototype.update = function update () - { - this.dirtyId++; - }; - - UniformGroup.prototype.add = function add (name, uniforms, _static) - { - this.uniforms[name] = new UniformGroup(uniforms, _static); - }; - - UniformGroup.from = function from (uniforms, _static) - { - return new UniformGroup(uniforms, _static); - }; + function UniformGroup(uniforms, _static) { + /** + * uniform values + * @member {object} + * @readonly + */ + this.uniforms = uniforms; + /** + * Its a group and not a single uniforms + * @member {boolean} + * @readonly + * @default true + */ + this.group = true; + // lets generate this when the shader ? + this.syncUniforms = {}; + /** + * dirty version + * @protected + * @member {number} + */ + this.dirtyId = 0; + /** + * unique id + * @protected + * @member {number} + */ + this.id = UID$2++; + /** + * Uniforms wont be changed after creation + * @member {boolean} + */ + this.static = !!_static; + } + UniformGroup.prototype.update = function () { + this.dirtyId++; + }; + UniformGroup.prototype.add = function (name, uniforms, _static) { + this.uniforms[name] = new UniformGroup(uniforms, _static); + }; + UniformGroup.from = function (uniforms, _static) { + return new UniformGroup(uniforms, _static); + }; + return UniformGroup; + }()); /** * System plugin to the renderer to manage filter states. @@ -22284,69 +20860,62 @@ var PIXI = (function (exports) { * @class * @private */ - var FilterState = function FilterState() - { - this.renderTexture = null; - + var FilterState = /** @class */ (function () { + function FilterState() { + this.renderTexture = null; + /** + * Target of the filters + * We store for case when custom filter wants to know the element it was applied on + * @member {PIXI.DisplayObject} + * @private + */ + this.target = null; + /** + * Compatibility with PixiJS v4 filters + * @member {boolean} + * @default false + * @private + */ + this.legacy = false; + /** + * Resolution of filters + * @member {number} + * @default 1 + * @private + */ + this.resolution = 1; + // next three fields are created only for root + // re-assigned for everything else + /** + * Source frame + * @member {PIXI.Rectangle} + * @private + */ + this.sourceFrame = new Rectangle(); + /** + * Destination frame + * @member {PIXI.Rectangle} + * @private + */ + this.destinationFrame = new Rectangle(); + /** + * Collection of filters + * @member {PIXI.Filter[]} + * @private + */ + this.filters = []; + } /** - * Target of the filters - * We store for case when custom filter wants to know the element it was applied on - * @member {PIXI.DisplayObject} + * clears the state * @private */ - this.target = null; - - /** - * Compatibility with PixiJS v4 filters - * @member {boolean} - * @default false - * @private - */ - this.legacy = false; - - /** - * Resolution of filters - * @member {number} - * @default 1 - * @private - */ - this.resolution = 1; - - // next three fields are created only for root - // re-assigned for everything else - - /** - * Source frame - * @member {PIXI.Rectangle} - * @private - */ - this.sourceFrame = new Rectangle(); - - /** - * Destination frame - * @member {PIXI.Rectangle} - * @private - */ - this.destinationFrame = new Rectangle(); - - /** - * Collection of filters - * @member {PIXI.Filter[]} - * @private - */ - this.filters = []; - }; - - /** - * clears the state - * @private - */ - FilterState.prototype.clear = function clear () - { - this.target = null; - this.filters = null; - this.renderTexture = null; - }; + FilterState.prototype.clear = function () { + this.target = null; + this.filters = null; + this.renderTexture = null; + }; + return FilterState; + }()); /** * System plugin to the renderer to manage the filters. @@ -22355,56 +20924,50 @@ var PIXI = (function (exports) { * @memberof PIXI.systems * @extends PIXI.System */ - var FilterSystem = /*@__PURE__*/(function (System) { - function FilterSystem(renderer) - { - System.call(this, renderer); - + var FilterSystem = /** @class */ (function (_super) { + __extends$2(FilterSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function FilterSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * List of filters for the FilterSystem * @member {Object[]} * @readonly */ - this.defaultFilterStack = [{}]; - + _this.defaultFilterStack = [{}]; /** * stores a bunch of PO2 textures used for filtering * @member {Object} */ - this.texturePool = new RenderTexturePool(); - - this.texturePool.setScreenSize(renderer.view); - + _this.texturePool = new RenderTexturePool(); + _this.texturePool.setScreenSize(renderer.view); /** * a pool for storing filter states, save us creating new ones each tick * @member {Object[]} */ - this.statePool = []; - + _this.statePool = []; /** * A very simple geometry used when drawing a filter effect to the screen * @member {PIXI.Quad} */ - this.quad = new Quad(); - + _this.quad = new Quad(); /** * Quad UVs * @member {PIXI.QuadUv} */ - this.quadUv = new QuadUv(); - + _this.quadUv = new QuadUv(); /** * Temporary rect for maths * @type {PIXI.Rectangle} */ - this.tempRect = new Rectangle(); - + _this.tempRect = new Rectangle(); /** * Active state * @member {object} */ - this.activeState = {}; - + _this.activeState = {}; /** * This uniform group is attached to filter uniforms when used * @member {PIXI.UniformGroup} @@ -22416,231 +20979,202 @@ var PIXI = (function (exports) { * @property {Float32Array} filterArea * @property {Fload32Array} filterClamp */ - this.globalUniforms = new UniformGroup({ - outputFrame: this.tempRect, + _this.globalUniforms = new UniformGroup({ + outputFrame: _this.tempRect, inputSize: new Float32Array(4), inputPixel: new Float32Array(4), inputClamp: new Float32Array(4), resolution: 1, - // legacy variables filterArea: new Float32Array(4), filterClamp: new Float32Array(4), }, true); - - this._pixelsWidth = renderer.view.width; - this._pixelsHeight = renderer.view.height; + /** + * Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES} + * @member {boolean} + */ + _this.forceClear = false; + /** + * Old padding behavior is to use the max amount instead of sum padding. + * Use this flag if you need the old behavior. + * @member {boolean} + * @default false + */ + _this.useMaxPadding = false; + return _this; } - - if ( System ) { FilterSystem.__proto__ = System; } - FilterSystem.prototype = Object.create( System && System.prototype ); - FilterSystem.prototype.constructor = FilterSystem; - /** * Adds a new filter to the System. * * @param {PIXI.DisplayObject} target - The target of the filter to render. * @param {PIXI.Filter[]} filters - The filters to apply. */ - FilterSystem.prototype.push = function push (target, filters) - { + FilterSystem.prototype.push = function (target, filters) { var renderer = this.renderer; var filterStack = this.defaultFilterStack; var state = this.statePool.pop() || new FilterState(); - var resolution = filters[0].resolution; var padding = filters[0].padding; var autoFit = filters[0].autoFit; var legacy = filters[0].legacy; - - for (var i = 1; i < filters.length; i++) - { - var filter = filters[i]; - + for (var i = 1; i < filters.length; i++) { + var filter = filters[i]; // lets use the lowest resolution.. resolution = Math.min(resolution, filter.resolution); - // and the largest amount of padding! - padding = Math.max(padding, filter.padding); + // figure out the padding required for filters + padding = this.useMaxPadding + // old behavior: use largest amount of padding! + ? Math.max(padding, filter.padding) + // new behavior: sum the padding + : padding + filter.padding; // only auto fit if all filters are autofit autoFit = autoFit || filter.autoFit; - legacy = legacy || filter.legacy; } - - if (filterStack.length === 1) - { + if (filterStack.length === 1) { this.defaultFilterStack[0].renderTexture = renderer.renderTexture.current; } - filterStack.push(state); - state.resolution = resolution; - state.legacy = legacy; - state.target = target; - state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true)); - state.sourceFrame.pad(padding); - if (autoFit) - { + if (autoFit) { state.sourceFrame.fit(this.renderer.renderTexture.sourceFrame); } - // round to whole number based on resolution state.sourceFrame.ceil(resolution); - state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution); state.filters = filters; - state.destinationFrame.width = state.renderTexture.width; state.destinationFrame.height = state.renderTexture.height; - + var destinationFrame = this.tempRect; + destinationFrame.width = state.sourceFrame.width; + destinationFrame.height = state.sourceFrame.height; state.renderTexture.filterFrame = state.sourceFrame; - - renderer.renderTexture.bind(state.renderTexture, state.sourceFrame);// /, state.destinationFrame); + renderer.renderTexture.bind(state.renderTexture, state.sourceFrame, destinationFrame); renderer.renderTexture.clear(); }; - /** * Pops off the filter and applies it. * */ - FilterSystem.prototype.pop = function pop () - { + FilterSystem.prototype.pop = function () { var filterStack = this.defaultFilterStack; var state = filterStack.pop(); var filters = state.filters; - this.activeState = state; - var globalUniforms = this.globalUniforms.uniforms; - globalUniforms.outputFrame = state.sourceFrame; globalUniforms.resolution = state.resolution; - var inputSize = globalUniforms.inputSize; var inputPixel = globalUniforms.inputPixel; var inputClamp = globalUniforms.inputClamp; - inputSize[0] = state.destinationFrame.width; inputSize[1] = state.destinationFrame.height; inputSize[2] = 1.0 / inputSize[0]; inputSize[3] = 1.0 / inputSize[1]; - inputPixel[0] = inputSize[0] * state.resolution; inputPixel[1] = inputSize[1] * state.resolution; inputPixel[2] = 1.0 / inputPixel[0]; inputPixel[3] = 1.0 / inputPixel[1]; - inputClamp[0] = 0.5 * inputPixel[2]; inputClamp[1] = 0.5 * inputPixel[3]; inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]); inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]); - // only update the rect if its legacy.. - if (state.legacy) - { + if (state.legacy) { var filterArea = globalUniforms.filterArea; - filterArea[0] = state.destinationFrame.width; filterArea[1] = state.destinationFrame.height; filterArea[2] = state.sourceFrame.x; filterArea[3] = state.sourceFrame.y; - globalUniforms.filterClamp = globalUniforms.inputClamp; } - this.globalUniforms.update(); - var lastState = filterStack[filterStack.length - 1]; - - if (filters.length === 1) - { - filters[0].apply(this, state.renderTexture, lastState.renderTexture, false, state); - + if (state.renderTexture.framebuffer.multisample > 1) { + this.renderer.framebuffer.blit(); + } + if (filters.length === 1) { + filters[0].apply(this, state.renderTexture, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); this.returnFilterTexture(state.renderTexture); } - else - { + else { var flip = state.renderTexture; - var flop = this.getOptimalFilterTexture( - flip.width, - flip.height, - state.resolution - ); - + var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution); flop.filterFrame = flip.filterFrame; - var i = 0; - - for (i = 0; i < filters.length - 1; ++i) - { - filters[i].apply(this, flip, flop, true, state); - + for (i = 0; i < filters.length - 1; ++i) { + filters[i].apply(this, flip, flop, exports.CLEAR_MODES.CLEAR, state); var t = flip; - flip = flop; flop = t; } - - filters[i].apply(this, flip, lastState.renderTexture, false, state); - + filters[i].apply(this, flip, lastState.renderTexture, exports.CLEAR_MODES.BLEND, state); this.returnFilterTexture(flip); this.returnFilterTexture(flop); } - state.clear(); this.statePool.push(state); }; - + /** + * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds. + * @param {PIXI.RenderTexture} filterTexture - renderTexture to bind, should belong to filter pool or filter stack + * @param {PIXI.CLEAR_MODES} [clearMode] - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES} + */ + FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) { + if (clearMode === void 0) { clearMode = exports.CLEAR_MODES.CLEAR; } + if (filterTexture && filterTexture.filterFrame) { + var destinationFrame = this.tempRect; + destinationFrame.width = filterTexture.filterFrame.width; + destinationFrame.height = filterTexture.filterFrame.height; + this.renderer.renderTexture.bind(filterTexture, filterTexture.filterFrame, destinationFrame); + } + else { + this.renderer.renderTexture.bind(filterTexture); + } + // TODO: remove in next major version + if (typeof clearMode === 'boolean') { + clearMode = clearMode ? exports.CLEAR_MODES.CLEAR : exports.CLEAR_MODES.BLEND; + // get deprecation function from utils + deprecation('5.2.1', 'Use CLEAR_MODES when using clear applyFilter option'); + } + if (clearMode === exports.CLEAR_MODES.CLEAR + || (clearMode === exports.CLEAR_MODES.BLIT && this.forceClear)) { + this.renderer.renderTexture.clear(); + } + }; /** * Draws a filter. * * @param {PIXI.Filter} filter - The filter to draw. * @param {PIXI.RenderTexture} input - The input render target. * @param {PIXI.RenderTexture} output - The target to output to. - * @param {boolean} clear - Should the output be cleared before rendering to it + * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it */ - FilterSystem.prototype.applyFilter = function applyFilter (filter, input, output, clear) - { + FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) { var renderer = this.renderer; - - renderer.renderTexture.bind(output, output ? output.filterFrame : null); - - if (clear) - { - // gl.disable(gl.SCISSOR_TEST); - renderer.renderTexture.clear(); - // gl.enable(gl.SCISSOR_TEST); - } - + this.bindAndClear(output, clearMode); // set the uniforms.. filter.uniforms.uSampler = input; filter.uniforms.filterGlobals = this.globalUniforms; - // TODO make it so that the order of this does not matter.. // because it does at the moment cos of global uniforms. // they need to get resynced - renderer.state.set(filter.state); renderer.shader.bind(filter); - - if (filter.legacy) - { + if (filter.legacy) { this.quadUv.map(input._frame, input.filterFrame); - renderer.geometry.bind(this.quadUv); renderer.geometry.draw(exports.DRAW_MODES.TRIANGLES); } - else - { + else { renderer.geometry.bind(this.quad); renderer.geometry.draw(exports.DRAW_MODES.TRIANGLE_STRIP); } }; - /** * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_. * @@ -22650,34 +21184,24 @@ var PIXI = (function (exports) { * @param {PIXI.Sprite} sprite - The sprite to map to. * @return {PIXI.Matrix} The mapped matrix. */ - FilterSystem.prototype.calculateSpriteMatrix = function calculateSpriteMatrix (outputMatrix, sprite) - { - var ref = this.activeState; - var sourceFrame = ref.sourceFrame; - var destinationFrame = ref.destinationFrame; - var ref$1 = sprite._texture; - var orig = ref$1.orig; - var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, - destinationFrame.height, sourceFrame.x, sourceFrame.y); + FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) { + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; + var orig = sprite._texture.orig; + var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y); var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX); - worldTransform.invert(); mappedMatrix.prepend(worldTransform); mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height); mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y); - return mappedMatrix; }; - /** * Destroys this Filter System. */ - FilterSystem.prototype.destroy = function destroy () - { + FilterSystem.prototype.destroy = function () { // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem this.texturePool.clear(false); }; - /** * Gets a Power-of-Two render texture or fullScreen texture * @@ -22687,66 +21211,49 @@ var PIXI = (function (exports) { * @param {number} [resolution=1] - The resolution of the render texture. * @return {PIXI.RenderTexture} The new render texture. */ - FilterSystem.prototype.getOptimalFilterTexture = function getOptimalFilterTexture (minWidth, minHeight, resolution) - { - if ( resolution === void 0 ) { resolution = 1; } - + FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution) { + if (resolution === void 0) { resolution = 1; } return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution); }; - /** * Gets extra render texture to use inside current filter * To be compliant with older filters, you can use params in any order * - * @param {PIXI.RenderTexture} [input] renderTexture from which size and resolution will be copied - * @param {number} [resolution] override resolution of the renderTexture + * @param {PIXI.RenderTexture} [input] - renderTexture from which size and resolution will be copied + * @param {number} [resolution] - override resolution of the renderTexture * @returns {PIXI.RenderTexture} */ - FilterSystem.prototype.getFilterTexture = function getFilterTexture (input, resolution) - { - if (typeof input === 'number') - { + FilterSystem.prototype.getFilterTexture = function (input, resolution) { + if (typeof input === 'number') { var swap = input; - input = resolution; resolution = swap; } - input = input || this.activeState.renderTexture; - var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution); - filterTexture.filterFrame = input.filterFrame; - return filterTexture; }; - /** * Frees a render texture back into the pool. * * @param {PIXI.RenderTexture} renderTexture - The renderTarget to free */ - FilterSystem.prototype.returnFilterTexture = function returnFilterTexture (renderTexture) - { + FilterSystem.prototype.returnFilterTexture = function (renderTexture) { this.texturePool.returnTexture(renderTexture); }; - /** * Empties the texture pool. */ - FilterSystem.prototype.emptyPool = function emptyPool () - { + FilterSystem.prototype.emptyPool = function () { this.texturePool.clear(true); }; - /** * calls `texturePool.resize()`, affects fullScreen renderTextures */ - FilterSystem.prototype.resize = function resize () - { + FilterSystem.prototype.resize = function () { this.texturePool.setScreenSize(this.renderer.view); }; - return FilterSystem; }(System)); @@ -22758,64 +21265,59 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI */ - var ObjectRenderer = function ObjectRenderer(renderer) - { + var ObjectRenderer = /** @class */ (function () { /** - * The renderer this manager works for. - * - * @member {PIXI.Renderer} + * @param {PIXI.Renderer} renderer - The renderer this manager works for. */ - this.renderer = renderer; - }; - - /** - * Stub method that should be used to empty the current - * batch by rendering objects now. - */ - ObjectRenderer.prototype.flush = function flush () - { - // flush! - }; - - /** - * Generic destruction method that frees all resources. This - * should be called by subclasses. - */ - ObjectRenderer.prototype.destroy = function destroy () - { - this.renderer = null; - }; - - /** - * Stub method that initializes any state required before - * rendering starts. It is different from the `prerender` - * signal, which occurs every frame, in that it is called - * whenever an object requests _this_ renderer specifically. - */ - ObjectRenderer.prototype.start = function start () - { - // set the shader.. - }; - - /** - * Stops the renderer. It should free up any state and - * become dormant. - */ - ObjectRenderer.prototype.stop = function stop () - { - this.flush(); - }; - - /** - * Keeps the object to render. It doesn't have to be - * rendered immediately. - * - * @param {PIXI.DisplayObject} object - The object to render. - */ - ObjectRenderer.prototype.render = function render (object) // eslint-disable-line no-unused-vars - { - // render the object - }; + function ObjectRenderer(renderer) { + /** + * The renderer this manager works for. + * + * @member {PIXI.Renderer} + */ + this.renderer = renderer; + } + /** + * Stub method that should be used to empty the current + * batch by rendering objects now. + */ + ObjectRenderer.prototype.flush = function () { + // flush! + }; + /** + * Generic destruction method that frees all resources. This + * should be called by subclasses. + */ + ObjectRenderer.prototype.destroy = function () { + this.renderer = null; + }; + /** + * Stub method that initializes any state required before + * rendering starts. It is different from the `prerender` + * signal, which occurs every frame, in that it is called + * whenever an object requests _this_ renderer specifically. + */ + ObjectRenderer.prototype.start = function () { + // set the shader.. + }; + /** + * Stops the renderer. It should free up any state and + * become dormant. + */ + ObjectRenderer.prototype.stop = function () { + this.flush(); + }; + /** + * Keeps the object to render. It doesn't have to be + * rendered immediately. + * + * @param {PIXI.DisplayObject} object - The object to render. + */ + ObjectRenderer.prototype.render = function (_object) { + // render the object + }; + return ObjectRenderer; + }()); /** * System plugin to the renderer to manage batching. @@ -22824,127 +21326,97 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var BatchSystem = /*@__PURE__*/(function (System) { - function BatchSystem(renderer) - { - System.call(this, renderer); - + var BatchSystem = /** @class */ (function (_super) { + __extends$2(BatchSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function BatchSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * An empty renderer. * * @member {PIXI.ObjectRenderer} */ - this.emptyRenderer = new ObjectRenderer(renderer); - + _this.emptyRenderer = new ObjectRenderer(renderer); /** * The currently active ObjectRenderer. * * @member {PIXI.ObjectRenderer} */ - this.currentRenderer = this.emptyRenderer; + _this.currentRenderer = _this.emptyRenderer; + return _this; } - - if ( System ) { BatchSystem.__proto__ = System; } - BatchSystem.prototype = Object.create( System && System.prototype ); - BatchSystem.prototype.constructor = BatchSystem; - /** * Changes the current renderer to the one given in parameter * * @param {PIXI.ObjectRenderer} objectRenderer - The object renderer to use. */ - BatchSystem.prototype.setObjectRenderer = function setObjectRenderer (objectRenderer) - { - if (this.currentRenderer === objectRenderer) - { + BatchSystem.prototype.setObjectRenderer = function (objectRenderer) { + if (this.currentRenderer === objectRenderer) { return; } - this.currentRenderer.stop(); this.currentRenderer = objectRenderer; - this.currentRenderer.start(); }; - /** * This should be called if you wish to do some custom rendering * It will basically render anything that may be batched up such as sprites */ - BatchSystem.prototype.flush = function flush () - { + BatchSystem.prototype.flush = function () { this.setObjectRenderer(this.emptyRenderer); }; - /** * Reset the system to an empty renderer */ - BatchSystem.prototype.reset = function reset () - { + BatchSystem.prototype.reset = function () { this.setObjectRenderer(this.emptyRenderer); }; - /** * Handy function for batch renderers: copies bound textures in first maxTextures locations to array * sets actual _batchLocation for them * - * @param arr - * @param maxTextures + * @param {PIXI.BaseTexture[]} - arr copy destination + * @param {number} maxTextures - number of copied elements */ - BatchSystem.prototype.copyBoundTextures = function copyBoundTextures (arr, maxTextures) - { - var ref = this.renderer.texture; - var boundTextures = ref.boundTextures; - - for (var i = maxTextures - 1; i >= 0; --i) - { + BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) { + var boundTextures = this.renderer.texture.boundTextures; + for (var i = maxTextures - 1; i >= 0; --i) { arr[i] = boundTextures[i] || null; - if (arr[i]) - { + if (arr[i]) { arr[i]._batchLocation = i; } } }; - /** * Assigns batch locations to textures in array based on boundTextures state. * All textures in texArray should have `_batchEnabled = _batchId`, * and their count should be less than `maxTextures`. * - * @param {PIXI.BatchTextureArray} texArray textures to bound - * @param {PIXI.BaseTexture[]} boundTextures current state of bound textures - * @param {number} batchId marker for _batchEnabled param of textures in texArray - * @param {number} maxTextures number of texture locations to manipulate + * @param {PIXI.BatchTextureArray} texArray - textures to bound + * @param {PIXI.BaseTexture[]} boundTextures - current state of bound textures + * @param {number} batchId - marker for _batchEnabled param of textures in texArray + * @param {number} maxTextures - number of texture locations to manipulate */ - BatchSystem.prototype.boundArray = function boundArray (texArray, boundTextures, batchId, maxTextures) - { - var elements = texArray.elements; - var ids = texArray.ids; - var count = texArray.count; + BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) { + var elements = texArray.elements, ids = texArray.ids, count = texArray.count; var j = 0; - - for (var i = 0; i < count; i++) - { + for (var i = 0; i < count; i++) { var tex = elements[i]; var loc = tex._batchLocation; - if (loc >= 0 && loc < maxTextures - && boundTextures[loc] === tex) - { + && boundTextures[loc] === tex) { ids[i] = loc; continue; } - - while (j < maxTextures) - { + while (j < maxTextures) { var bound = boundTextures[j]; - if (bound && bound._batchEnabled === batchId - && bound._batchLocation === j) - { + && bound._batchLocation === j) { j++; continue; } - ids[i] = j; tex._batchLocation = j; boundTextures[j] = tex; @@ -22952,48 +21424,10 @@ var PIXI = (function (exports) { } } }; - return BatchSystem; }(System)); - /** - * The maximum support for using WebGL. If a device does not - * support WebGL version, for instance WebGL 2, it will still - * attempt to fallback support to WebGL 1. If you want to - * explicitly remove feature support to target a more stable - * baseline, prefer a lower environment. - * - * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium} - * we disable webgl2 by default for all non-apple mobile devices. - * - * @static - * @name PREFER_ENV - * @memberof PIXI.settings - * @type {number} - * @default PIXI.ENV.WEBGL2 - */ - settings.PREFER_ENV = isMobile$1.any ? exports.ENV.WEBGL : exports.ENV.WEBGL2; - - /** - * If set to `true`, Textures and BaseTexture objects stored - * in the caches ({@link PIXI.utils.TextureCache TextureCache} and - * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can *only* be - * used when calling {@link PIXI.Texture.from Texture.from} or - * {@link PIXI.BaseTexture.from BaseTexture.from}. - * Otherwise, these `from` calls throw an exception. Using this property - * can be useful if you want to enforce preloading all assets with - * {@link PIXI.Loader Loader}. - * - * @static - * @name STRICT_TEXTURE_CACHE - * @memberof PIXI.settings - * @type {boolean} - * @default false - */ - settings.STRICT_TEXTURE_CACHE = false; - - var CONTEXT_UID = 0; - + var CONTEXT_UID_COUNTER = 0; /** * System plugin to the renderer to manage the context. * @@ -23001,18 +21435,20 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var ContextSystem = /*@__PURE__*/(function (System) { - function ContextSystem(renderer) - { - System.call(this, renderer); - + var ContextSystem = /** @class */ (function (_super) { + __extends$2(ContextSystem, _super); + /* eslint-enable camelcase */ + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ContextSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * Either 1 or 2 to reflect the WebGL version being used * @member {number} * @readonly */ - this.webGLVersion = 1; - + _this.webGLVersion = 1; /** * Extensions being used * @member {object} @@ -23024,64 +21460,62 @@ var PIXI = (function (exports) { * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension */ - this.extensions = {}; - + _this.extensions = {}; + /** + * Features supported by current context + * @member {object} + * @private + * @readonly + * @property {boolean} uint32Indices - Supports of 32-bit indices buffer + */ + _this.supports = { + uint32Indices: false, + }; // Bind functions - this.handleContextLost = this.handleContextLost.bind(this); - this.handleContextRestored = this.handleContextRestored.bind(this); - - renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false); - renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false); + _this.handleContextLost = _this.handleContextLost.bind(_this); + _this.handleContextRestored = _this.handleContextRestored.bind(_this); + renderer.view.addEventListener('webglcontextlost', _this.handleContextLost, false); + renderer.view.addEventListener('webglcontextrestored', _this.handleContextRestored, false); + return _this; } - - if ( System ) { ContextSystem.__proto__ = System; } - ContextSystem.prototype = Object.create( System && System.prototype ); - ContextSystem.prototype.constructor = ContextSystem; - - var prototypeAccessors = { isLost: { configurable: true } }; - - /** - * `true` if the context is lost - * @member {boolean} - * @readonly - */ - prototypeAccessors.isLost.get = function () - { - return (!this.gl || this.gl.isContextLost()); - }; - + Object.defineProperty(ContextSystem.prototype, "isLost", { + /** + * `true` if the context is lost + * @member {boolean} + * @readonly + */ + get: function () { + return (!this.gl || this.gl.isContextLost()); + }, + enumerable: false, + configurable: true + }); /** * Handle the context change event - * @param {WebGLRenderingContext} gl new webgl context + * @param {WebGLRenderingContext} gl - new webgl context */ - ContextSystem.prototype.contextChange = function contextChange (gl) - { + ContextSystem.prototype.contextChange = function (gl) { this.gl = gl; this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID++; - + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; // restore a context if it was previously lost - if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) - { + if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) { gl.getExtension('WEBGL_lose_context').restoreContext(); } }; - /** * Initialize the context * * @protected * @param {WebGLRenderingContext} gl - WebGL context */ - ContextSystem.prototype.initFromContext = function initFromContext (gl) - { + ContextSystem.prototype.initFromContext = function (gl) { this.gl = gl; this.validateContext(gl); this.renderer.gl = gl; - this.renderer.CONTEXT_UID = CONTEXT_UID++; - this.renderer.runners.contextChange.run(gl); + this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++; + this.renderer.runners.contextChange.emit(gl); }; - /** * Initialize from context options * @@ -23089,13 +21523,10 @@ var PIXI = (function (exports) { * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext * @param {object} options - context attributes */ - ContextSystem.prototype.initFromOptions = function initFromOptions (options) - { + ContextSystem.prototype.initFromOptions = function (options) { var gl = this.createContext(this.renderer.view, options); - this.initFromContext(gl); }; - /** * Helper class to create a WebGL Context * @@ -23104,56 +21535,39 @@ var PIXI = (function (exports) { * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext * @return {WebGLRenderingContext} the WebGL context */ - ContextSystem.prototype.createContext = function createContext (canvas, options) - { + ContextSystem.prototype.createContext = function (canvas, options) { var gl; - - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) - { + if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { gl = canvas.getContext('webgl2', options); } - - if (gl) - { + if (gl) { this.webGLVersion = 2; } - else - { + else { this.webGLVersion = 1; - gl = canvas.getContext('webgl', options) - || canvas.getContext('experimental-webgl', options); - - if (!gl) - { + || canvas.getContext('experimental-webgl', options); + if (!gl) { // fail, not able to get a context throw new Error('This browser does not support WebGL. Try using the canvas renderer'); } } - this.gl = gl; - this.getExtensions(); - - return gl; + return this.gl; }; - /** * Auto-populate the extensions * * @protected */ - ContextSystem.prototype.getExtensions = function getExtensions () - { + ContextSystem.prototype.getExtensions = function () { // time to set up default extensions that Pixi uses. - var ref = this; - var gl = ref.gl; - - if (this.webGLVersion === 1) - { + var gl = this.gl; + if (this.webGLVersion === 1) { Object.assign(this.extensions, { drawBuffers: gl.getExtension('WEBGL_draw_buffers'), - depthTexture: gl.getExtension('WEBKIT_WEBGL_depth_texture'), + depthTexture: gl.getExtension('WEBGL_depth_texture'), loseContext: gl.getExtension('WEBGL_lose_context'), vertexArrayObject: gl.getExtension('OES_vertex_array_object') || gl.getExtension('MOZ_OES_vertex_array_object') @@ -23167,8 +21581,7 @@ var PIXI = (function (exports) { textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'), }); } - else if (this.webGLVersion === 2) - { + else if (this.webGLVersion === 2) { Object.assign(this.extensions, { anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'), // Floats and half-floats @@ -23177,85 +21590,125 @@ var PIXI = (function (exports) { }); } }; - /** * Handles a lost webgl context * * @protected * @param {WebGLContextEvent} event - The context lost event. */ - ContextSystem.prototype.handleContextLost = function handleContextLost (event) - { + ContextSystem.prototype.handleContextLost = function (event) { event.preventDefault(); }; - /** * Handles a restored webgl context * * @protected */ - ContextSystem.prototype.handleContextRestored = function handleContextRestored () - { - this.renderer.runners.contextChange.run(this.gl); + ContextSystem.prototype.handleContextRestored = function () { + this.renderer.runners.contextChange.emit(this.gl); }; - - ContextSystem.prototype.destroy = function destroy () - { + ContextSystem.prototype.destroy = function () { var view = this.renderer.view; - // remove listeners view.removeEventListener('webglcontextlost', this.handleContextLost); view.removeEventListener('webglcontextrestored', this.handleContextRestored); - this.gl.useProgram(null); - - if (this.extensions.loseContext) - { + if (this.extensions.loseContext) { this.extensions.loseContext.loseContext(); } }; - /** * Handle the post-render runner event * * @protected */ - ContextSystem.prototype.postrender = function postrender () - { - if (this.renderer.renderingToScreen) - { + ContextSystem.prototype.postrender = function () { + if (this.renderer.renderingToScreen) { this.gl.flush(); } }; - /** * Validate context * * @protected * @param {WebGLRenderingContext} gl - Render context */ - ContextSystem.prototype.validateContext = function validateContext (gl) - { + ContextSystem.prototype.validateContext = function (gl) { var attributes = gl.getContextAttributes(); - // this is going to be fairly simple for now.. but at least we have room to grow! - if (!attributes.stencil) - { - /* eslint-disable max-len */ - - /* eslint-disable no-console */ + if (!attributes.stencil) { + /* eslint-disable max-len, no-console */ console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly'); - /* eslint-enable no-console */ - - /* eslint-enable max-len */ + /* eslint-enable max-len, no-console */ + } + var hasuint32 = ('WebGL2RenderingContext' in window && gl instanceof window.WebGL2RenderingContext) + || !!gl.getExtension('OES_element_index_uint'); + this.supports.uint32Indices = hasuint32; + if (!hasuint32) { + /* eslint-disable max-len, no-console */ + console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly'); + /* eslint-enable max-len, no-console */ } }; - - Object.defineProperties( ContextSystem.prototype, prototypeAccessors ); - return ContextSystem; }(System)); + /** + * Internal framebuffer for WebGL context + * @class + * @memberof PIXI + */ + var GLFramebuffer = /** @class */ (function () { + function GLFramebuffer(framebuffer) { + /** + * The WebGL framebuffer + * @member {WebGLFramebuffer} + */ + this.framebuffer = framebuffer; + /** + * stencil+depth , usually costs 32bits per pixel + * @member {WebGLRenderbuffer} + */ + this.stencil = null; + /** + * latest known version of framebuffer + * @member {number} + * @protected + */ + this.dirtyId = 0; + /** + * latest known version of framebuffer format + * @member {number} + * @protected + */ + this.dirtyFormat = 0; + /** + * latest known version of framebuffer size + * @member {number} + * @protected + */ + this.dirtySize = 0; + /** + * Detected AA samples number + * @member {PIXI.MSAA_QUALITY} + */ + this.multisample = exports.MSAA_QUALITY.NONE; + /** + * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info + * @member {WebGLRenderbuffer} + */ + this.msaaBuffer = null; + /** + * In case we use MSAA, this is actual framebuffer that has colorTextures[0] + * The contents of that framebuffer are read when we use that renderTexture in sprites + * @member {PIXI.Framebuffer} + */ + this.blitFramebuffer = null; + } + return GLFramebuffer; + }()); + + var tempRectangle = new Rectangle(); /** * System plugin to the renderer to manage framebuffers. * @@ -23263,165 +21716,124 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var FramebufferSystem = /*@__PURE__*/(function (System) { - function FramebufferSystem(renderer) - { - System.call(this, renderer); - + var FramebufferSystem = /** @class */ (function (_super) { + __extends$2(FramebufferSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function FramebufferSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * A list of managed framebuffers * @member {PIXI.Framebuffer[]} * @readonly */ - this.managedFramebuffers = []; - + _this.managedFramebuffers = []; /** * Framebuffer value that shows that we don't know what is bound * @member {Framebuffer} * @readonly */ - this.unknownFramebuffer = new Framebuffer(10, 10); + _this.unknownFramebuffer = new Framebuffer(10, 10); + _this.msaaSamples = null; + return _this; } - - if ( System ) { FramebufferSystem.__proto__ = System; } - FramebufferSystem.prototype = Object.create( System && System.prototype ); - FramebufferSystem.prototype.constructor = FramebufferSystem; - - var prototypeAccessors = { size: { configurable: true } }; - /** * Sets up the renderer context and necessary buffers. */ - FramebufferSystem.prototype.contextChange = function contextChange () - { + FramebufferSystem.prototype.contextChange = function () { var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; this.current = this.unknownFramebuffer; this.viewport = new Rectangle(); this.hasMRT = true; this.writeDepthTexture = true; - this.disposeAll(true); - // webgl2 - if (this.renderer.context.webGLVersion === 1) - { + if (this.renderer.context.webGLVersion === 1) { // webgl 1! - var nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers; + var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers; var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture; - - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) - { - nativeDrawBuffersExtension = null; + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { + nativeDrawBuffersExtension_1 = null; nativeDepthTextureExtension = null; } - - if (nativeDrawBuffersExtension) - { - gl.drawBuffers = function (activeTextures) { return nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures); }; + if (nativeDrawBuffersExtension_1) { + gl.drawBuffers = function (activeTextures) { + return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures); + }; } - else - { + else { this.hasMRT = false; gl.drawBuffers = function () { // empty }; } - - if (!nativeDepthTextureExtension) - { + if (!nativeDepthTextureExtension) { this.writeDepthTexture = false; } } + else { + // WebGL2 + // cache possible MSAA samples + this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES); + } }; - /** * Bind a framebuffer * * @param {PIXI.Framebuffer} framebuffer * @param {PIXI.Rectangle} [frame] frame, default is framebuffer size */ - FramebufferSystem.prototype.bind = function bind (framebuffer, frame) - { - var ref = this; - var gl = ref.gl; - - if (framebuffer) - { + FramebufferSystem.prototype.bind = function (framebuffer, frame) { + var gl = this.gl; + if (framebuffer) { // TODO caching layer! - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer); - - if (this.current !== framebuffer) - { + if (this.current !== framebuffer) { this.current = framebuffer; gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer); } // make sure all textures are unbound.. - // now check for updates... - if (fbo.dirtyId !== framebuffer.dirtyId) - { + if (fbo.dirtyId !== framebuffer.dirtyId) { fbo.dirtyId = framebuffer.dirtyId; - - if (fbo.dirtyFormat !== framebuffer.dirtyFormat) - { + if (fbo.dirtyFormat !== framebuffer.dirtyFormat) { fbo.dirtyFormat = framebuffer.dirtyFormat; this.updateFramebuffer(framebuffer); } - else if (fbo.dirtySize !== framebuffer.dirtySize) - { + else if (fbo.dirtySize !== framebuffer.dirtySize) { fbo.dirtySize = framebuffer.dirtySize; this.resizeFramebuffer(framebuffer); } } - - for (var i = 0; i < framebuffer.colorTextures.length; i++) - { - if (framebuffer.colorTextures[i].texturePart) - { - this.renderer.texture.unbind(framebuffer.colorTextures[i].texture); - } - else - { - this.renderer.texture.unbind(framebuffer.colorTextures[i]); - } + for (var i = 0; i < framebuffer.colorTextures.length; i++) { + var tex = framebuffer.colorTextures[i]; + this.renderer.texture.unbind(tex.parentTextureArray || tex); } - - if (framebuffer.depthTexture) - { + if (framebuffer.depthTexture) { this.renderer.texture.unbind(framebuffer.depthTexture); } - - if (frame) - { + if (frame) { this.setViewport(frame.x, frame.y, frame.width, frame.height); } - else - { + else { this.setViewport(0, 0, framebuffer.width, framebuffer.height); } } - else - { - if (this.current) - { + else { + if (this.current) { this.current = null; gl.bindFramebuffer(gl.FRAMEBUFFER, null); } - - if (frame) - { + if (frame) { this.setViewport(frame.x, frame.y, frame.width, frame.height); } - else - { + else { this.setViewport(0, 0, this.renderer.width, this.renderer.height); } } }; - /** * Set the WebGLRenderingContext's viewport. * @@ -23430,38 +21842,33 @@ var PIXI = (function (exports) { * @param {Number} width - Width of viewport * @param {Number} height - Height of viewport */ - FramebufferSystem.prototype.setViewport = function setViewport (x, y, width, height) - { + FramebufferSystem.prototype.setViewport = function (x, y, width, height) { var v = this.viewport; - - if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) - { + if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) { v.x = x; v.y = y; v.width = width; v.height = height; - this.gl.viewport(x, y, width, height); } }; - - /** - * Get the size of the current width and height. Returns object with `width` and `height` values. - * - * @member {object} - * @readonly - */ - prototypeAccessors.size.get = function () - { - if (this.current) - { - // TODO store temp - return { x: 0, y: 0, width: this.current.width, height: this.current.height }; - } - - return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; - }; - + Object.defineProperty(FramebufferSystem.prototype, "size", { + /** + * Get the size of the current width and height. Returns object with `width` and `height` values. + * + * @member {object} + * @readonly + */ + get: function () { + if (this.current) { + // TODO store temp + return { x: 0, y: 0, width: this.current.width, height: this.current.height }; + } + return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height }; + }, + enumerable: false, + configurable: true + }); /** * Clear the color of the context * @@ -23469,220 +21876,213 @@ var PIXI = (function (exports) { * @param {Number} g - Green value from 0 to 1 * @param {Number} b - Blue value from 0 to 1 * @param {Number} a - Alpha value from 0 to 1 + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. */ - FramebufferSystem.prototype.clear = function clear (r, g, b, a) - { - var ref = this; - var gl = ref.gl; - + FramebufferSystem.prototype.clear = function (r, g, b, a, mask) { + if (mask === void 0) { mask = exports.BUFFER_BITS.COLOR | exports.BUFFER_BITS.DEPTH; } + var gl = this.gl; // TODO clear color can be set only one right? gl.clearColor(r, g, b, a); - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.clear(mask); }; - /** - * Initialize framebuffer + * Initialize framebuffer for this context * * @protected * @param {PIXI.Framebuffer} framebuffer + * @returns {PIXI.GLFramebuffer} created GLFramebuffer */ - FramebufferSystem.prototype.initFramebuffer = function initFramebuffer (framebuffer) - { - var ref = this; - var gl = ref.gl; - - // TODO - make this a class? - var fbo = { - framebuffer: gl.createFramebuffer(), - stencil: null, - dirtyId: 0, - dirtyFormat: 0, - dirtySize: 0, - }; - + FramebufferSystem.prototype.initFramebuffer = function (framebuffer) { + var gl = this.gl; + var fbo = new GLFramebuffer(gl.createFramebuffer()); + fbo.multisample = this.detectSamples(framebuffer.multisample); framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo; - this.managedFramebuffers.push(framebuffer); framebuffer.disposeRunner.add(this); - return fbo; }; - /** * Resize the framebuffer * * @protected * @param {PIXI.Framebuffer} framebuffer */ - FramebufferSystem.prototype.resizeFramebuffer = function resizeFramebuffer (framebuffer) - { - var ref = this; - var gl = ref.gl; - + FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) { + var gl = this.gl; var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - - if (fbo.stencil) - { + if (fbo.stencil) { gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); } - var colorTextures = framebuffer.colorTextures; - - for (var i = 0; i < colorTextures.length; i++) - { + for (var i = 0; i < colorTextures.length; i++) { this.renderer.texture.bind(colorTextures[i], 0); } - - if (framebuffer.depthTexture) - { + if (framebuffer.depthTexture) { this.renderer.texture.bind(framebuffer.depthTexture, 0); } }; - /** * Update the framebuffer * * @protected * @param {PIXI.Framebuffer} framebuffer */ - FramebufferSystem.prototype.updateFramebuffer = function updateFramebuffer (framebuffer) - { - var ref = this; - var gl = ref.gl; - + FramebufferSystem.prototype.updateFramebuffer = function (framebuffer) { + var gl = this.gl; var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - // bind the color texture var colorTextures = framebuffer.colorTextures; - var count = colorTextures.length; - - if (!gl.drawBuffers) - { + if (!gl.drawBuffers) { count = Math.min(count, 1); } - + if (fbo.multisample > 1) { + fbo.msaaBuffer = gl.createRenderbuffer(); + gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer); + gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer); + } var activeTextures = []; - - for (var i = 0; i < count; i++) - { + for (var i = 0; i < count; i++) { + if (i === 0 && fbo.multisample > 1) { + continue; + } var texture = framebuffer.colorTextures[i]; - - if (texture.texturePart) - { - this.renderer.texture.bind(texture.texture, 0); - - gl.framebufferTexture2D(gl.FRAMEBUFFER, - gl.COLOR_ATTACHMENT0 + i, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X + texture.side, - texture.texture._glTextures[this.CONTEXT_UID].texture, - 0); - } - else - { - this.renderer.texture.bind(texture, 0); - - gl.framebufferTexture2D(gl.FRAMEBUFFER, - gl.COLOR_ATTACHMENT0 + i, - gl.TEXTURE_2D, - texture._glTextures[this.CONTEXT_UID].texture, - 0); - } - + var parentTexture = texture.parentTextureArray || texture; + this.renderer.texture.bind(parentTexture, 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, 0); activeTextures.push(gl.COLOR_ATTACHMENT0 + i); } - - if (activeTextures.length > 1) - { + if (activeTextures.length > 1) { gl.drawBuffers(activeTextures); } - - if (framebuffer.depthTexture) - { + if (framebuffer.depthTexture) { var writeDepthTexture = this.writeDepthTexture; - - if (writeDepthTexture) - { + if (writeDepthTexture) { var depthTexture = framebuffer.depthTexture; - this.renderer.texture.bind(depthTexture, 0); - - gl.framebufferTexture2D(gl.FRAMEBUFFER, - gl.DEPTH_ATTACHMENT, - gl.TEXTURE_2D, - depthTexture._glTextures[this.CONTEXT_UID].texture, - 0); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, 0); } } - - if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) - { + if (!fbo.stencil && (framebuffer.stencil || framebuffer.depth)) { fbo.stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil); - gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height); // TODO.. this is depth AND stencil? - if (!framebuffer.depthTexture) - { // you can't have both, so one should take priority if enabled + if (!framebuffer.depthTexture) { // you can't have both, so one should take priority if enabled gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil); } } }; - /** - * Disposes framebuffer - * @param {PIXI.Framebuffer} framebuffer framebuffer that has to be disposed of - * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls + * Detects number of samples that is not more than a param but as close to it as possible + * + * @param {PIXI.MSAA_QUALITY} samples - number of samples + * @returns {PIXI.MSAA_QUALITY} - recommended number of samples */ - FramebufferSystem.prototype.disposeFramebuffer = function disposeFramebuffer (framebuffer, contextLost) - { - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - var gl = this.gl; - - if (!fbo) - { + FramebufferSystem.prototype.detectSamples = function (samples) { + var msaaSamples = this.msaaSamples; + var res = exports.MSAA_QUALITY.NONE; + if (samples <= 1 || msaaSamples === null) { + return res; + } + for (var i = 0; i < msaaSamples.length; i++) { + if (msaaSamples[i] <= samples) { + res = msaaSamples[i]; + break; + } + } + if (res === 1) { + res = exports.MSAA_QUALITY.NONE; + } + return res; + }; + /** + * Only works with WebGL2 + * + * blits framebuffer to another of the same or bigger size + * after that target framebuffer is bound + * + * Fails with WebGL warning if blits multisample framebuffer to different size + * + * @param {PIXI.Framebuffer} [framebuffer] - by default it blits "into itself", from renderBuffer to texture. + * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels + * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels + */ + FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) { + var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID; + if (renderer.context.webGLVersion !== 2) { + return; + } + if (!current) { + return; + } + var fbo = current.glFramebuffers[CONTEXT_UID]; + if (!fbo) { + return; + } + if (!framebuffer) { + if (fbo.multisample <= 1) { + return; + } + if (!fbo.blitFramebuffer) { + fbo.blitFramebuffer = new Framebuffer(current.width, current.height); + fbo.blitFramebuffer.addColorTexture(0, current.colorTextures[0]); + } + framebuffer = fbo.blitFramebuffer; + framebuffer.width = current.width; + framebuffer.height = current.height; + } + if (!sourcePixels) { + sourcePixels = tempRectangle; + sourcePixels.width = current.width; + sourcePixels.height = current.height; + } + if (!destPixels) { + destPixels = sourcePixels; + } + var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height; + this.bind(framebuffer); + gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer); + gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR); + }; + /** + * Disposes framebuffer + * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of + * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls + */ + FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) { + var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; + var gl = this.gl; + if (!fbo) { return; } - delete framebuffer.glFramebuffers[this.CONTEXT_UID]; - var index = this.managedFramebuffers.indexOf(framebuffer); - - if (index >= 0) - { + if (index >= 0) { this.managedFramebuffers.splice(index, 1); } - framebuffer.disposeRunner.remove(this); - - if (!contextLost) - { + if (!contextLost) { gl.deleteFramebuffer(fbo.framebuffer); - if (fbo.stencil) - { + if (fbo.stencil) { gl.deleteRenderbuffer(fbo.stencil); } } }; - /** * Disposes all framebuffers, but not textures bound to them - * @param {boolean} [contextLost=false] If context was lost, we suppress all delete function calls + * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls */ - FramebufferSystem.prototype.disposeAll = function disposeAll (contextLost) - { + FramebufferSystem.prototype.disposeAll = function (contextLost) { var list = this.managedFramebuffers; - this.managedFramebuffers = []; - - for (var i = 0; i < list.length; i++) - { + for (var i = 0; i < list.length; i++) { this.disposeFramebuffer(list[i], contextLost); } }; - /** * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before. * Used by MaskSystem, when its time to use stencil mask for Graphics element. @@ -23691,61 +22091,48 @@ var PIXI = (function (exports) { * * @private */ - FramebufferSystem.prototype.forceStencil = function forceStencil () - { + FramebufferSystem.prototype.forceStencil = function () { var framebuffer = this.current; - - if (!framebuffer) - { + if (!framebuffer) { return; } - var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID]; - - if (!fbo || fbo.stencil) - { + if (!fbo || fbo.stencil) { return; } framebuffer.enableStencil(); - var w = framebuffer.width; var h = framebuffer.height; var gl = this.gl; var stencil = gl.createRenderbuffer(); - gl.bindRenderbuffer(gl.RENDERBUFFER, stencil); gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h); - fbo.stencil = stencil; gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil); }; - /** * resets framebuffer stored state, binds screen framebuffer * * should be called before renderTexture reset() */ - FramebufferSystem.prototype.reset = function reset () - { + FramebufferSystem.prototype.reset = function () { this.current = this.unknownFramebuffer; this.viewport = new Rectangle(); }; - - Object.defineProperties( FramebufferSystem.prototype, prototypeAccessors ); - return FramebufferSystem; }(System)); - var GLBuffer = function GLBuffer(buffer) - { - this.buffer = buffer; - this.updateID = -1; - this.byteLength = -1; - this.refCount = 0; - }; + var GLBuffer = /** @class */ (function () { + function GLBuffer(buffer) { + this.buffer = buffer || null; + this.updateID = -1; + this.byteLength = -1; + this.refCount = 0; + } + return GLBuffer; + }()); var byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 }; - /** * System plugin to the renderer to manage geometry. * @@ -23753,212 +22140,160 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var GeometrySystem = /*@__PURE__*/(function (System) { - function GeometrySystem(renderer) - { - System.call(this, renderer); - - this._activeGeometry = null; - this._activeVao = null; - + var GeometrySystem = /** @class */ (function (_super) { + __extends$2(GeometrySystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function GeometrySystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this._activeGeometry = null; + _this._activeVao = null; /** * `true` if we has `*_vertex_array_object` extension * @member {boolean} * @readonly */ - this.hasVao = true; - + _this.hasVao = true; /** * `true` if has `ANGLE_instanced_arrays` extension * @member {boolean} * @readonly */ - this.hasInstance = true; - + _this.hasInstance = true; /** * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced` * @member {boolean} * @readonly */ - this.canUseUInt32ElementIndex = false; - - /** - * A cache of currently bound buffer, - * contains only two members with keys ARRAY_BUFFER and ELEMENT_ARRAY_BUFFER - * @member {Object.} - * @readonly - */ - this.boundBuffers = {}; - + _this.canUseUInt32ElementIndex = false; /** * Cache for all geometries by id, used in case renderer gets destroyed or for profiling * @member {object} * @readonly */ - this.managedGeometries = {}; - + _this.managedGeometries = {}; /** * Cache for all buffers by id, used in case renderer gets destroyed or for profiling * @member {object} * @readonly */ - this.managedBuffers = {}; + _this.managedBuffers = {}; + return _this; } - - if ( System ) { GeometrySystem.__proto__ = System; } - GeometrySystem.prototype = Object.create( System && System.prototype ); - GeometrySystem.prototype.constructor = GeometrySystem; - /** * Sets up the renderer context and necessary buffers. */ - GeometrySystem.prototype.contextChange = function contextChange () - { + GeometrySystem.prototype.contextChange = function () { this.disposeAll(true); - var gl = this.gl = this.renderer.gl; var context = this.renderer.context; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - // webgl2 - if (!gl.createVertexArray) - { + if (!gl.createVertexArray) { // webgl 1! - var nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject; - - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) - { - nativeVaoExtension = null; + var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject; + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { + nativeVaoExtension_1 = null; } - - if (nativeVaoExtension) - { - gl.createVertexArray = function () { return nativeVaoExtension.createVertexArrayOES(); }; - - gl.bindVertexArray = function (vao) { return nativeVaoExtension.bindVertexArrayOES(vao); }; - - gl.deleteVertexArray = function (vao) { return nativeVaoExtension.deleteVertexArrayOES(vao); }; + if (nativeVaoExtension_1) { + gl.createVertexArray = function () { + return nativeVaoExtension_1.createVertexArrayOES(); + }; + gl.bindVertexArray = function (vao) { + return nativeVaoExtension_1.bindVertexArrayOES(vao); + }; + gl.deleteVertexArray = function (vao) { + return nativeVaoExtension_1.deleteVertexArrayOES(vao); + }; } - else - { + else { this.hasVao = false; gl.createVertexArray = function () { - // empty + return null; }; - gl.bindVertexArray = function () { - // empty + return null; }; - gl.deleteVertexArray = function () { - // empty + return null; }; } } - - if (!gl.vertexAttribDivisor) - { - var instanceExt = gl.getExtension('ANGLE_instanced_arrays'); - - if (instanceExt) - { - gl.vertexAttribDivisor = function (a, b) { return instanceExt.vertexAttribDivisorANGLE(a, b); }; - - gl.drawElementsInstanced = function (a, b, c, d, e) { return instanceExt.drawElementsInstancedANGLE(a, b, c, d, e); }; - - gl.drawArraysInstanced = function (a, b, c, d) { return instanceExt.drawArraysInstancedANGLE(a, b, c, d); }; + if (!gl.vertexAttribDivisor) { + var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays'); + if (instanceExt_1) { + gl.vertexAttribDivisor = function (a, b) { + return instanceExt_1.vertexAttribDivisorANGLE(a, b); + }; + gl.drawElementsInstanced = function (a, b, c, d, e) { + return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e); + }; + gl.drawArraysInstanced = function (a, b, c, d) { + return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d); + }; } - else - { + else { this.hasInstance = false; } } - this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex; }; - /** * Binds geometry so that is can be drawn. Creating a Vao if required * - * @param {PIXI.Geometry} geometry instance of geometry to bind - * @param {PIXI.Shader} [shader] instance of shader to use vao for + * @param {PIXI.Geometry} geometry - instance of geometry to bind + * @param {PIXI.Shader} [shader] - instance of shader to use vao for */ - GeometrySystem.prototype.bind = function bind (geometry, shader) - { + GeometrySystem.prototype.bind = function (geometry, shader) { shader = shader || this.renderer.shader.shader; - - var ref = this; - var gl = ref.gl; - + var gl = this.gl; // not sure the best way to address this.. // currently different shaders require different VAOs for the same geometry // Still mulling over the best way to solve this one.. // will likely need to modify the shader attribute locations at run time! var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - - if (!vaos) - { + if (!vaos) { this.managedGeometries[geometry.id] = geometry; geometry.disposeRunner.add(this); geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {}; } - var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader.program); - this._activeGeometry = geometry; - - if (this._activeVao !== vao) - { + if (this._activeVao !== vao) { this._activeVao = vao; - - if (this.hasVao) - { + if (this.hasVao) { gl.bindVertexArray(vao); } - else - { + else { this.activateVao(geometry, shader.program); } } - // TODO - optimise later! // don't need to loop through if nothing changed! // maybe look to add an 'autoupdate' to geometry? this.updateBuffers(); }; - /** * Reset and unbind any active VAO and geometry */ - GeometrySystem.prototype.reset = function reset () - { + GeometrySystem.prototype.reset = function () { this.unbind(); }; - /** * Update buffers * @protected */ - GeometrySystem.prototype.updateBuffers = function updateBuffers () - { + GeometrySystem.prototype.updateBuffers = function () { var geometry = this._activeGeometry; - var ref = this; - var gl = ref.gl; - - for (var i = 0; i < geometry.buffers.length; i++) - { + var gl = this.gl; + for (var i = 0; i < geometry.buffers.length; i++) { var buffer = geometry.buffers[i]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; - - if (buffer._updateID !== glBuffer.updateID) - { + if (buffer._updateID !== glBuffer.updateID) { glBuffer.updateID = buffer._updateID; - // TODO can cache this on buffer! maybe added a getter / setter? var type = buffer.index ? gl.ELEMENT_ARRAY_BUFFER : gl.ARRAY_BUFFER; - // TODO this could change if the VAO changes... // need to come up with a better way to cache.. // if (this.boundBuffers[type] !== glBuffer) @@ -23966,72 +22301,54 @@ var PIXI = (function (exports) { // this.boundBuffers[type] = glBuffer; gl.bindBuffer(type, glBuffer.buffer); // } - this._boundBuffer = glBuffer; - - if (glBuffer.byteLength >= buffer.data.byteLength) - { + if (glBuffer.byteLength >= buffer.data.byteLength) { // offset is always zero for now! gl.bufferSubData(type, 0, buffer.data); } - else - { + else { var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW; - glBuffer.byteLength = buffer.data.byteLength; gl.bufferData(type, buffer.data, drawType); } } } }; - /** * Check compability between a geometry and a program * @protected * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Program instance */ - GeometrySystem.prototype.checkCompatibility = function checkCompatibility (geometry, program) - { + GeometrySystem.prototype.checkCompatibility = function (geometry, program) { // geometry must have at least all the attributes that the shader requires. var geometryAttributes = geometry.attributes; var shaderAttributes = program.attributeData; - - for (var j in shaderAttributes) - { - if (!geometryAttributes[j]) - { - throw new Error(("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute")); + for (var j in shaderAttributes) { + if (!geometryAttributes[j]) { + throw new Error("shader and geometry incompatible, geometry missing the \"" + j + "\" attribute"); } } }; - /** * Takes a geometry and program and generates a unique signature for them. * - * @param {PIXI.Geometry} geometry to get signature from - * @param {PIXI.Program} program to test geometry against + * @param {PIXI.Geometry} geometry - to get signature from + * @param {PIXI.Program} program - to test geometry against * @returns {String} Unique signature of the geometry and program * @protected */ - GeometrySystem.prototype.getSignature = function getSignature (geometry, program) - { + GeometrySystem.prototype.getSignature = function (geometry, program) { var attribs = geometry.attributes; var shaderAttributes = program.attributeData; - var strings = ['g', geometry.id]; - - for (var i in attribs) - { - if (shaderAttributes[i]) - { + for (var i in attribs) { + if (shaderAttributes[i]) { strings.push(i); } } - return strings.join('-'); }; - /** * Creates or gets Vao with the same structure as the geometry and stores it on the geometry. * If vao is created, it is bound automatically. @@ -24040,219 +22357,146 @@ var PIXI = (function (exports) { * @param {PIXI.Geometry} geometry - Instance of geometry to to generate Vao for * @param {PIXI.Program} program - Instance of program */ - GeometrySystem.prototype.initGeometryVao = function initGeometryVao (geometry, program) - { + GeometrySystem.prototype.initGeometryVao = function (geometry, program) { this.checkCompatibility(geometry, program); - var gl = this.gl; var CONTEXT_UID = this.CONTEXT_UID; - var signature = this.getSignature(geometry, program); - var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID]; - var vao = vaoObjectHash[signature]; - - if (vao) - { + if (vao) { // this will give us easy access to the vao vaoObjectHash[program.id] = vao; - return vao; } - var buffers = geometry.buffers; var attributes = geometry.attributes; var tempStride = {}; var tempStart = {}; - - for (var j in buffers) - { + for (var j in buffers) { tempStride[j] = 0; tempStart[j] = 0; } - - for (var j$1 in attributes) - { - if (!attributes[j$1].size && program.attributeData[j$1]) - { - attributes[j$1].size = program.attributeData[j$1].size; + for (var j in attributes) { + if (!attributes[j].size && program.attributeData[j]) { + attributes[j].size = program.attributeData[j].size; } - else if (!attributes[j$1].size) - { - console.warn(("PIXI Geometry attribute '" + j$1 + "' size cannot be determined (likely the bound shader does not have the attribute)")); // eslint-disable-line + else if (!attributes[j].size) { + console.warn("PIXI Geometry attribute '" + j + "' size cannot be determined (likely the bound shader does not have the attribute)"); // eslint-disable-line } - - tempStride[attributes[j$1].buffer] += attributes[j$1].size * byteSizeMap$1[attributes[j$1].type]; + tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type]; } - - for (var j$2 in attributes) - { - var attribute = attributes[j$2]; + for (var j in attributes) { + var attribute = attributes[j]; var attribSize = attribute.size; - - if (attribute.stride === undefined) - { - if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) - { + if (attribute.stride === undefined) { + if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) { attribute.stride = 0; } - else - { + else { attribute.stride = tempStride[attribute.buffer]; } } - - if (attribute.start === undefined) - { + if (attribute.start === undefined) { attribute.start = tempStart[attribute.buffer]; - tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type]; } } - vao = gl.createVertexArray(); - gl.bindVertexArray(vao); - // first update - and create the buffers! // only create a gl buffer if it actually gets - for (var i = 0; i < buffers.length; i++) - { + for (var i = 0; i < buffers.length; i++) { var buffer = buffers[i]; - - if (!buffer._glBuffers[CONTEXT_UID]) - { + if (!buffer._glBuffers[CONTEXT_UID]) { buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer()); this.managedBuffers[buffer.id] = buffer; buffer.disposeRunner.add(this); } - buffer._glBuffers[CONTEXT_UID].refCount++; } - // TODO - maybe make this a data object? // lets wait to see if we need to first! - this.activateVao(geometry, program); - this._activeVao = vao; - // add it to the cache! vaoObjectHash[program.id] = vao; vaoObjectHash[signature] = vao; - return vao; }; - /** * Disposes buffer - * @param {PIXI.Buffer} buffer buffer with data - * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray + * @param {PIXI.Buffer} buffer - buffer with data + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray */ - GeometrySystem.prototype.disposeBuffer = function disposeBuffer (buffer, contextLost) - { - if (!this.managedBuffers[buffer.id]) - { + GeometrySystem.prototype.disposeBuffer = function (buffer, contextLost) { + if (!this.managedBuffers[buffer.id]) { return; } - delete this.managedBuffers[buffer.id]; - var glBuffer = buffer._glBuffers[this.CONTEXT_UID]; var gl = this.gl; - buffer.disposeRunner.remove(this); - - if (!glBuffer) - { + if (!glBuffer) { return; } - - if (!contextLost) - { + if (!contextLost) { gl.deleteBuffer(glBuffer.buffer); } - delete buffer._glBuffers[this.CONTEXT_UID]; }; - /** * Disposes geometry - * @param {PIXI.Geometry} geometry Geometry with buffers. Only VAO will be disposed - * @param {boolean} [contextLost=false] If context was lost, we suppress deleteVertexArray + * @param {PIXI.Geometry} geometry - Geometry with buffers. Only VAO will be disposed + * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray */ - GeometrySystem.prototype.disposeGeometry = function disposeGeometry (geometry, contextLost) - { - if (!this.managedGeometries[geometry.id]) - { + GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) { + if (!this.managedGeometries[geometry.id]) { return; } - delete this.managedGeometries[geometry.id]; - var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID]; var gl = this.gl; var buffers = geometry.buffers; - geometry.disposeRunner.remove(this); - - if (!vaos) - { + if (!vaos) { return; } - - for (var i = 0; i < buffers.length; i++) - { + for (var i = 0; i < buffers.length; i++) { var buf = buffers[i]._glBuffers[this.CONTEXT_UID]; - buf.refCount--; - if (buf.refCount === 0 && !contextLost) - { + if (buf.refCount === 0 && !contextLost) { this.disposeBuffer(buffers[i], contextLost); } } - - if (!contextLost) - { - for (var vaoId in vaos) - { + if (!contextLost) { + for (var vaoId in vaos) { // delete only signatures, everything else are copies - if (vaoId[0] === 'g') - { + if (vaoId[0] === 'g') { var vao = vaos[vaoId]; - - if (this._activeVao === vao) - { + if (this._activeVao === vao) { this.unbind(); } gl.deleteVertexArray(vao); } } } - delete geometry.glVertexArrayObjects[this.CONTEXT_UID]; }; - /** * dispose all WebGL resources of all managed geometries and buffers - * @param {boolean} [contextLost=false] If context was lost, we suppress `gl.delete` calls + * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls */ - GeometrySystem.prototype.disposeAll = function disposeAll (contextLost) - { + GeometrySystem.prototype.disposeAll = function (contextLost) { var all = Object.keys(this.managedGeometries); - - for (var i = 0; i < all.length; i++) - { + for (var i = 0; i < all.length; i++) { this.disposeGeometry(this.managedGeometries[all[i]], contextLost); } all = Object.keys(this.managedBuffers); - for (var i$1 = 0; i$1 < all.length; i$1++) - { - this.disposeBuffer(this.managedBuffers[all[i$1]], contextLost); + for (var i = 0; i < all.length; i++) { + this.disposeBuffer(this.managedBuffers[all[i]], contextLost); } }; - /** * Activate vertex array object * @@ -24260,66 +22504,43 @@ var PIXI = (function (exports) { * @param {PIXI.Geometry} geometry - Geometry instance * @param {PIXI.Program} program - Shader program instance */ - GeometrySystem.prototype.activateVao = function activateVao (geometry, program) - { + GeometrySystem.prototype.activateVao = function (geometry, program) { var gl = this.gl; var CONTEXT_UID = this.CONTEXT_UID; var buffers = geometry.buffers; var attributes = geometry.attributes; - - if (geometry.indexBuffer) - { + if (geometry.indexBuffer) { // first update the index buffer if we have one.. gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geometry.indexBuffer._glBuffers[CONTEXT_UID].buffer); } - var lastBuffer = null; - // add a new one! - for (var j in attributes) - { + for (var j in attributes) { var attribute = attributes[j]; var buffer = buffers[attribute.buffer]; var glBuffer = buffer._glBuffers[CONTEXT_UID]; - - if (program.attributeData[j]) - { - if (lastBuffer !== glBuffer) - { + if (program.attributeData[j]) { + if (lastBuffer !== glBuffer) { gl.bindBuffer(gl.ARRAY_BUFFER, glBuffer.buffer); - lastBuffer = glBuffer; } - var location = program.attributeData[j].location; - // TODO introduce state again // we can optimise this for older devices that have no VAOs gl.enableVertexAttribArray(location); - - gl.vertexAttribPointer(location, - attribute.size, - attribute.type || gl.FLOAT, - attribute.normalized, - attribute.stride, - attribute.start); - - if (attribute.instance) - { + gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start); + if (attribute.instance) { // TODO calculate instance count based of this... - if (this.hasInstance) - { + if (this.hasInstance) { gl.vertexAttribDivisor(location, 1); } - else - { + else { throw new Error('geometry error, GPU Instancing is not supported on this device'); } } } } }; - /** * Draw the geometry * @@ -24328,63 +22549,47 @@ var PIXI = (function (exports) { * @param {Number} [start] - Starting index * @param {Number} [instanceCount] - the number of instances of the set of elements to execute */ - GeometrySystem.prototype.draw = function draw (type, size, start, instanceCount) - { - var ref = this; - var gl = ref.gl; + GeometrySystem.prototype.draw = function (type, size, start, instanceCount) { + var gl = this.gl; var geometry = this._activeGeometry; - // TODO.. this should not change so maybe cache the function? - - if (geometry.indexBuffer) - { + if (geometry.indexBuffer) { var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT; var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT; - - if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) - { - if (geometry.instanced) - { + if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) { + if (geometry.instanced) { /* eslint-disable max-len */ gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1); /* eslint-enable max-len */ } - else - { + else { /* eslint-disable max-len */ gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize); /* eslint-enable max-len */ } } - else - { + else { console.warn('unsupported index buffer type: uint32'); } } - else if (geometry.instanced) - { + else if (geometry.instanced) { // TODO need a better way to calculate size.. gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1); } - else - { + else { gl.drawArrays(type, start, size || geometry.getSize()); } - return this; }; - /** * Unbind/reset everything * @protected */ - GeometrySystem.prototype.unbind = function unbind () - { + GeometrySystem.prototype.unbind = function () { this.gl.bindVertexArray(null); this._activeVao = null; this._activeGeometry = null; }; - return GeometrySystem; }(System)); @@ -24396,104 +22601,108 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var MaskData = function MaskData(maskObject) - { + var MaskData = /** @class */ (function () { /** - * Mask type - * @member {PIXI.MASK_TYPES} + * Create MaskData + * + * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask */ - this.type = exports.MASK_TYPES.NONE; - - /** - * Whether we know the mask type beforehand - * @member {boolean} - * @default true - */ - this.autoDetect = true; - - /** - * Which element we use to mask - * @member {PIXI.DisplayObject} - */ - this.maskObject = maskObject || null; - - /** - * Whether it belongs to MaskSystem pool - * @member {boolean} - */ - this.pooled = false; - - /** - * Indicator of the type - * @member {boolean} - */ - this.isMaskData = true; - - /** - * Stencil counter above the mask in stack - * @member {number} - * @private - */ - this._stencilCounter = 0; - /** - * Scissor counter above the mask in stack - * @member {number} - * @private - */ - this._scissorCounter = 0; - - /** - * Scissor operation above the mask in stack. - * Null if _scissorCounter is zero, rectangle instance if positive. - * @member {PIXI.Rectangle} - */ - this._scissorRect = null; - - /** - * Targeted element. Temporary variable set by MaskSystem - * @member {PIXI.DisplayObject} - * @private - */ - this._target = null; - }; - - /** - * resets the mask data after popMask() - */ - MaskData.prototype.reset = function reset () - { - if (this.pooled) - { - this.maskObject = null; - + function MaskData(maskObject) { + if (maskObject === void 0) { maskObject = null; } + /** + * Mask type + * @member {PIXI.MASK_TYPES} + */ this.type = exports.MASK_TYPES.NONE; - + /** + * Whether we know the mask type beforehand + * @member {boolean} + * @default true + */ this.autoDetect = true; + /** + * Which element we use to mask + * @member {PIXI.DisplayObject} + */ + this.maskObject = maskObject || null; + /** + * Whether it belongs to MaskSystem pool + * @member {boolean} + */ + this.pooled = false; + /** + * Indicator of the type + * @member {boolean} + */ + this.isMaskData = true; + /** + * Stencil counter above the mask in stack + * @member {number} + * @private + */ + this._stencilCounter = 0; + /** + * Scissor counter above the mask in stack + * @member {number} + * @private + */ + this._scissorCounter = 0; + /** + * Scissor operation above the mask in stack. + * Null if _scissorCounter is zero, rectangle instance if positive. + * @member {PIXI.Rectangle} + */ + this._scissorRect = null; + /** + * Targeted element. Temporary variable set by MaskSystem + * @member {PIXI.DisplayObject} + * @private + */ + this._target = null; } - - this._target = null; - }; + /** + * resets the mask data after popMask() + */ + MaskData.prototype.reset = function () { + if (this.pooled) { + this.maskObject = null; + this.type = exports.MASK_TYPES.NONE; + this.autoDetect = true; + } + this._target = null; + }; + /** + * copies counters from maskData above, called from pushMask() + * @param {PIXI.MaskData|null} maskAbove + */ + MaskData.prototype.copyCountersOrReset = function (maskAbove) { + if (maskAbove) { + this._stencilCounter = maskAbove._stencilCounter; + this._scissorCounter = maskAbove._scissorCounter; + this._scissorRect = maskAbove._scissorRect; + } + else { + this._stencilCounter = 0; + this._scissorCounter = 0; + this._scissorRect = null; + } + }; + return MaskData; + }()); /** - * copies counters from maskData above, called from pushMask() - * @param {PIXI.MaskData|null} maskAbove + * @private + * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} + * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER + * @param src {string} The vertex shader source as an array of strings. + * @return {WebGLShader} the shader */ - MaskData.prototype.copyCountersOrReset = function copyCountersOrReset (maskAbove) - { - if (maskAbove) - { - this._stencilCounter = maskAbove._stencilCounter; - this._scissorCounter = maskAbove._scissorCounter; - this._scissorRect = maskAbove._scissorRect; - } - else - { - this._stencilCounter = 0; - this._scissorCounter = 0; - this._scissorRect = null; - } - }; - + function compileShader(gl, type, src) { + var shader = gl.createShader(type); + gl.shaderSource(shader, src); + gl.compileShader(shader); + return shader; + } /** * @method compileProgram * @private @@ -24504,80 +22713,52 @@ var PIXI = (function (exports) { * @param attributeLocations {Object} An attribute location map that lets you manually set the attribute locations * @return {WebGLProgram} the shader program */ - function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) - { + function compileProgram(gl, vertexSrc, fragmentSrc, attributeLocations) { var glVertShader = compileShader(gl, gl.VERTEX_SHADER, vertexSrc); var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSrc); - var program = gl.createProgram(); - gl.attachShader(program, glVertShader); gl.attachShader(program, glFragShader); - // optionally, set the attributes manually for the program rather than letting WebGL decide.. - if (attributeLocations) - { - for (var i in attributeLocations) - { + if (attributeLocations) { + for (var i in attributeLocations) { gl.bindAttribLocation(program, attributeLocations[i], i); } } - gl.linkProgram(program); - // if linking fails, then log and cleanup - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) - { - if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) - { + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { + if (!gl.getShaderParameter(glVertShader, gl.COMPILE_STATUS)) { console.warn(vertexSrc); console.error(gl.getShaderInfoLog(glVertShader)); } - - if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) - { + if (!gl.getShaderParameter(glFragShader, gl.COMPILE_STATUS)) { console.warn(fragmentSrc); console.error(gl.getShaderInfoLog(glFragShader)); } - console.error('Pixi.js Error: Could not initialize shader.'); console.error('gl.VALIDATE_STATUS', gl.getProgramParameter(program, gl.VALIDATE_STATUS)); console.error('gl.getError()', gl.getError()); - // if there is a program info log, log it - if (gl.getProgramInfoLog(program) !== '') - { + if (gl.getProgramInfoLog(program) !== '') { console.warn('Pixi.js Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program)); } - gl.deleteProgram(program); program = null; } - // clean up some shaders gl.deleteShader(glVertShader); gl.deleteShader(glFragShader); - return program; } - /** - * @private - * @param gl {WebGLRenderingContext} The current WebGL context {WebGLProgram} - * @param type {Number} the type, can be either VERTEX_SHADER or FRAGMENT_SHADER - * @param vertexSrc {string|string[]} The vertex shader source as an array of strings. - * @return {WebGLShader} the shader - */ - function compileShader(gl, type, src) - { - var shader = gl.createShader(type); - - gl.shaderSource(shader, src); - gl.compileShader(shader); - - return shader; + function booleanArray(size) { + var array = new Array(size); + for (var i = 0; i < array.length; i++) { + array[i] = false; + } + return array; } - /** * @method defaultValue * @memberof PIXI.glCore.shader @@ -24585,83 +22766,52 @@ var PIXI = (function (exports) { * @param size {Number} * @private */ - function defaultValue(type, size) - { - switch (type) - { + function defaultValue(type, size) { + switch (type) { case 'float': return 0; - case 'vec2': return new Float32Array(2 * size); - case 'vec3': return new Float32Array(3 * size); - case 'vec4': return new Float32Array(4 * size); - case 'int': case 'sampler2D': case 'sampler2DArray': return 0; - case 'ivec2': return new Int32Array(2 * size); - case 'ivec3': return new Int32Array(3 * size); - case 'ivec4': return new Int32Array(4 * size); - case 'bool': return false; - case 'bvec2': - return booleanArray(2 * size); - case 'bvec3': return booleanArray(3 * size); - case 'bvec4': return booleanArray(4 * size); - case 'mat2': return new Float32Array([1, 0, 0, 1]); - case 'mat3': return new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); - case 'mat4': return new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); } - return null; } - function booleanArray(size) - { - var array = new Array(size); - - for (var i = 0; i < array.length; i++) - { - array[i] = false; - } - - return array; - } - var unknownContext = {}; var context = unknownContext; - /** * returns a little WebGL context to use for program inspection. * @@ -24669,62 +22819,42 @@ var PIXI = (function (exports) { * @private * @returns {WebGLRenderingContext} a gl context to test with */ - function getTestContext() - { - if (context === unknownContext || (context && context.isContextLost())) - { + function getTestContext() { + if (context === unknownContext || (context && context.isContextLost())) { var canvas = document.createElement('canvas'); - - var gl; - - if (settings.PREFER_ENV >= exports.ENV.WEBGL2) - { + var gl = void 0; + if (settings.PREFER_ENV >= exports.ENV.WEBGL2) { gl = canvas.getContext('webgl2', {}); } - - if (!gl) - { + if (!gl) { gl = canvas.getContext('webgl', {}) - || canvas.getContext('experimental-webgl', {}); - - if (!gl) - { + || canvas.getContext('experimental-webgl', {}); + if (!gl) { // fail, not able to get a context gl = null; } - else - { + else { // for shader testing.. gl.getExtension('WEBGL_draw_buffers'); } } - context = gl; } - return context; } var maxFragmentPrecision; - - function getMaxFragmentPrecision() - { - if (!maxFragmentPrecision) - { + function getMaxFragmentPrecision() { + if (!maxFragmentPrecision) { maxFragmentPrecision = exports.PRECISION.MEDIUM; var gl = getTestContext(); - - if (gl) - { - if (gl.getShaderPrecisionFormat) - { + if (gl) { + if (gl.getShaderPrecisionFormat) { var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT); - maxFragmentPrecision = shaderFragment.precision ? exports.PRECISION.HIGH : exports.PRECISION.MEDIUM; } } } - return maxFragmentPrecision; } @@ -24739,53 +22869,41 @@ var PIXI = (function (exports) { * * @return {string} modified shader source */ - function setPrecision(src, requestedPrecision, maxSupportedPrecision) - { - if (src.substring(0, 9) !== 'precision') - { + function setPrecision(src, requestedPrecision, maxSupportedPrecision) { + if (src.substring(0, 9) !== 'precision') { // no precision supplied, so PixiJS will add the requested level. var precision = requestedPrecision; - // If highp is requested but not supported, downgrade precision to a level all devices support. - if (requestedPrecision === exports.PRECISION.HIGH && maxSupportedPrecision !== exports.PRECISION.HIGH) - { + if (requestedPrecision === exports.PRECISION.HIGH && maxSupportedPrecision !== exports.PRECISION.HIGH) { precision = exports.PRECISION.MEDIUM; } - - return ("precision " + precision + " float;\n" + src); + return "precision " + precision + " float;\n" + src; } - else if (maxSupportedPrecision !== exports.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') - { + else if (maxSupportedPrecision !== exports.PRECISION.HIGH && src.substring(0, 15) === 'precision highp') { // precision was supplied, but at a level this device does not support, so downgrading to mediump. return src.replace('precision highp', 'precision mediump'); } - return src; } var GLSL_TO_SIZE = { - 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, + 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, }; - /** * @private * @method mapSize @@ -24793,202 +22911,207 @@ var PIXI = (function (exports) { * @param type {String} * @return {Number} */ - function mapSize(type) - { + function mapSize(type) { return GLSL_TO_SIZE[type]; } var GL_TABLE = null; - var GL_TO_GLSL_TYPES = { - 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', + 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', + INT_SAMPLER_2D: 'sampler2D', + UNSIGNED_INT_SAMPLER_2D: 'sampler2D', + SAMPLER_CUBE: 'samplerCube', + INT_SAMPLER_CUBE: 'samplerCube', + UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube', + SAMPLER_2D_ARRAY: 'sampler2DArray', + INT_SAMPLER_2D_ARRAY: 'sampler2DArray', + UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray', }; - - function mapType(gl, type) - { - if (!GL_TABLE) - { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function mapType(gl, type) { + if (!GL_TABLE) { var typeNames = Object.keys(GL_TO_GLSL_TYPES); - GL_TABLE = {}; - - for (var i = 0; i < typeNames.length; ++i) - { + for (var i = 0; i < typeNames.length; ++i) { var tn = typeNames[i]; - GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn]; } } - return GL_TABLE[type]; } + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ + // Parsers, each one of these will take a look at the type of shader property and uniform. + // if they pass the test function then the code function is called that returns a the shader upload code for that uniform. + // Shader upload code is automagically generated with these parsers. + // If no parser is valid then the default upload functions are used. + // exposing Parsers means that custom upload logic can be added to pixi's shaders. + // A good example would be a pixi rectangle can be directly set on a uniform. + // If the shader sees it it knows how to upload the rectangle structure as a vec4 + // format is as follows: + // + // { + // test: (data, uniform) => {} <--- test is this code should be used for this uniform + // code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform + // } + var uniformParsers = [ + // a float cache layer + { + test: function (data) { + return data.type === 'float' && data.size === 1; + }, + code: function (name) { + return "\n if(uv[\"" + name + "\"] !== ud[\"" + name + "\"].value)\n {\n ud[\"" + name + "\"].value = uv[\"" + name + "\"]\n gl.uniform1f(ud[\"" + name + "\"].location, uv[\"" + name + "\"])\n }\n "; + }, + }, + // handling samplers + { + test: function (data) { + // eslint-disable-next-line max-len + return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray; + }, + code: function (name) { return "t = syncData.textureCount++;\n\n renderer.texture.bind(uv[\"" + name + "\"], t);\n\n if(ud[\"" + name + "\"].value !== t)\n {\n ud[\"" + name + "\"].value = t;\n gl.uniform1i(ud[\"" + name + "\"].location, t);\n; // eslint-disable-line max-len\n }"; }, + }, + // uploading pixi matrix object to mat3 + { + test: function (data, uniform) { + return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined; + }, + code: function (name) { + // TODO and some smart caching dirty ids here! + return "\n gl.uniformMatrix3fv(ud[\"" + name + "\"].location, false, uv[\"" + name + "\"].toArray(true));\n "; + }, + }, + // uploading a pixi point as a vec2 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud[\"" + name + "\"].location, v.x, v.y);\n }"; + }, + }, + // caching layer for a vec2 + { + test: function (data) { + return data.type === 'vec2' && data.size === 1; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud[\"" + name + "\"].location, v[0], v[1]);\n }\n "; + }, + }, + // upload a pixi rectangle as a vec4 with caching layer + { + test: function (data, uniform) { + return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud[\"" + name + "\"].location, v.x, v.y, v.width, v.height)\n }"; + }, + }, + // a caching layer for vec4 uploading + { + test: function (data) { + return data.type === 'vec4' && data.size === 1; + }, + code: function (name) { + return "\n cv = ud[\"" + name + "\"].value;\n v = uv[\"" + name + "\"];\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud[\"" + name + "\"].location, v[0], v[1], v[2], v[3])\n }"; + }, + } ]; + // cv = CachedValue // v = value // ud = uniformData // uv = uniformValue // l = location var GLSL_TO_SINGLE_SETTERS_CACHED = { - float: "\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }", - vec2: "\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }", - vec3: "\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", - - vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])', - - int: 'gl.uniform1i(location, v)', - ivec2: 'gl.uniform2i(location, v[0], v[1])', - ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - - bool: 'gl.uniform1i(location, v)', - bvec2: 'gl.uniform2i(location, v[0], v[1])', - bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])', - bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', - - mat2: 'gl.uniformMatrix2fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat4: 'gl.uniformMatrix4fv(location, false, v)', - - sampler2D: 'gl.uniform1i(location, v)', - samplerCube: 'gl.uniform1i(location, v)', + vec4: 'gl.uniform4f(location, v[0], v[1], v[2], v[3])', + int: 'gl.uniform1i(location, v)', + ivec2: 'gl.uniform2i(location, v[0], v[1])', + ivec3: 'gl.uniform3i(location, v[0], v[1], v[2])', + ivec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', + bool: 'gl.uniform1i(location, v)', + bvec2: 'gl.uniform2i(location, v[0], v[1])', + bvec3: 'gl.uniform3i(location, v[0], v[1], v[2])', + bvec4: 'gl.uniform4i(location, v[0], v[1], v[2], v[3])', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + sampler2D: 'gl.uniform1i(location, v)', + samplerCube: 'gl.uniform1i(location, v)', sampler2DArray: 'gl.uniform1i(location, v)', }; - var GLSL_TO_ARRAY_SETTERS = { - - float: "gl.uniform1fv(location, v)", - - vec2: "gl.uniform2fv(location, v)", - vec3: "gl.uniform3fv(location, v)", - vec4: 'gl.uniform4fv(location, v)', - - mat4: 'gl.uniformMatrix4fv(location, false, v)', - mat3: 'gl.uniformMatrix3fv(location, false, v)', - mat2: 'gl.uniformMatrix2fv(location, false, v)', - - int: 'gl.uniform1iv(location, v)', - ivec2: 'gl.uniform2iv(location, v)', - ivec3: 'gl.uniform3iv(location, v)', - ivec4: 'gl.uniform4iv(location, v)', - - bool: 'gl.uniform1iv(location, v)', - bvec2: 'gl.uniform2iv(location, v)', - bvec3: 'gl.uniform3iv(location, v)', - bvec4: 'gl.uniform4iv(location, v)', - - sampler2D: 'gl.uniform1iv(location, v)', - samplerCube: 'gl.uniform1iv(location, v)', + float: "gl.uniform1fv(location, v)", + vec2: "gl.uniform2fv(location, v)", + vec3: "gl.uniform3fv(location, v)", + vec4: 'gl.uniform4fv(location, v)', + mat4: 'gl.uniformMatrix4fv(location, false, v)', + mat3: 'gl.uniformMatrix3fv(location, false, v)', + mat2: 'gl.uniformMatrix2fv(location, false, v)', + int: 'gl.uniform1iv(location, v)', + ivec2: 'gl.uniform2iv(location, v)', + ivec3: 'gl.uniform3iv(location, v)', + ivec4: 'gl.uniform4iv(location, v)', + bool: 'gl.uniform1iv(location, v)', + bvec2: 'gl.uniform2iv(location, v)', + bvec3: 'gl.uniform3iv(location, v)', + bvec4: 'gl.uniform4iv(location, v)', + sampler2D: 'gl.uniform1iv(location, v)', + samplerCube: 'gl.uniform1iv(location, v)', sampler2DArray: 'gl.uniform1iv(location, v)', }; - - function generateUniformsSync(group, uniformData) - { - var func = "var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "; - - for (var i in group.uniforms) - { + function generateUniformsSync(group, uniformData) { + var funcFragments = ["\n var v = null;\n var cv = null\n var t = 0;\n var gl = renderer.gl\n "]; + for (var i in group.uniforms) { var data = uniformData[i]; - - if (!data) - { - if (group.uniforms[i].group) - { - func += "\n renderer.shader.syncUniformGroup(uv." + i + ", syncData);\n "; + if (!data) { + if (group.uniforms[i].group) { + funcFragments.push("\n renderer.shader.syncUniformGroup(uv[\"" + i + "\"], syncData);\n "); } - continue; } - - // TODO && uniformData[i].value !== 0 <-- do we still need this? - if (data.type === 'float' && data.size === 1) - { - func += "\n if(uv." + i + " !== ud." + i + ".value)\n {\n ud." + i + ".value = uv." + i + "\n gl.uniform1f(ud." + i + ".location, uv." + i + ")\n }\n"; - } - /* eslint-disable max-len */ - else if ((data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray) - /* eslint-disable max-len */ - { - func += "\n\n t = syncData.textureCount++;\n\n renderer.texture.bind(uv." + i + ", t);\n \n if(ud." + i + ".value !== t)\n {\n ud." + i + ".value = t;\n gl.uniform1i(ud." + i + ".location, t);\n; // eslint-disable-line max-len\n }\n"; - } - else if (data.type === 'mat3' && data.size === 1) - { - if (group.uniforms[i].a !== undefined) - { - // TODO and some smart caching dirty ids here! - func += "\n gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ".toArray(true));\n \n"; - } - else - { - func += "\n gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ");\n \n"; + var uniform = group.uniforms[i]; + var parsed = false; + for (var j = 0; j < uniformParsers.length; j++) { + if (uniformParsers[j].test(data, uniform)) { + funcFragments.push(uniformParsers[j].code(i, uniform)); + parsed = true; + break; } } - else if (data.type === 'vec2' && data.size === 1) - { - // TODO - do we need both here? - // maybe we can get away with only using points? - if (group.uniforms[i].x !== undefined) - { - func += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud." + i + ".location, v.x, v.y);\n }\n"; - } - else - { - func += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud." + i + ".location, v[0], v[1]);\n }\n \n"; - } - } - else if (data.type === 'vec4' && data.size === 1) - { - // TODO - do we need both here? - // maybe we can get away with only using points? - if (group.uniforms[i].width !== undefined) - { - func += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud." + i + ".location, v.x, v.y, v.width, v.height)\n }\n"; - } - else - { - func += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud." + i + ".location, v[0], v[1], v[2], v[3])\n }\n \n"; - } - } - else - { + if (!parsed) { var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS; - - var template = templateType[data.type].replace('location', ("ud." + i + ".location")); - - func += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n " + template + ";\n"; + var template = templateType[data.type].replace('location', "ud[\"" + i + "\"].location"); + funcFragments.push("\n cv = ud[\"" + i + "\"].value;\n v = uv[\"" + i + "\"];\n " + template + ";"); } } - /** * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used * no matter which group is being used * */ - return new Function('ud', 'uv', 'renderer', 'syncData', func); // eslint-disable-line no-new-func + // eslint-disable-next-line no-new-func + return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\n')); } var fragTemplate = [ @@ -24998,60 +23121,41 @@ var PIXI = (function (exports) { '%forloop%', 'gl_FragColor = vec4(0.0);', '}' ].join('\n'); - - function checkMaxIfStatementsInShader(maxIfs, gl) - { - if (maxIfs === 0) - { + function generateIfTestSrc(maxIfs) { + var src = ''; + for (var i = 0; i < maxIfs; ++i) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxIfs - 1) { + src += "if(test == " + i + ".0){}"; + } + } + return src; + } + function checkMaxIfStatementsInShader(maxIfs, gl) { + if (maxIfs === 0) { throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`'); } - var shader = gl.createShader(gl.FRAGMENT_SHADER); - while (true) // eslint-disable-line no-constant-condition - { + { var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs)); - gl.shaderSource(shader, fragmentSrc); gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) - { + if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { maxIfs = (maxIfs / 2) | 0; } - else - { + else { // valid! break; } } - return maxIfs; } - function generateIfTestSrc(maxIfs) - { - var src = ''; - - for (var i = 0; i < maxIfs; ++i) - { - if (i > 0) - { - src += '\nelse '; - } - - if (i < maxIfs - 1) - { - src += "if(test == " + i + ".0){}"; - } - } - - return src; - } - // Cache the result to prevent running this over and over var unsafeEval; - /** * Not all platforms allow to generate function code (e.g., `new Function`). * this provides the platform-level detection. @@ -25059,26 +23163,19 @@ var PIXI = (function (exports) { * @private * @returns {boolean} */ - function unsafeEvalSupported() - { - if (typeof unsafeEval === 'boolean') - { + function unsafeEvalSupported() { + if (typeof unsafeEval === 'boolean') { return unsafeEval; } - - try - { + try { /* eslint-disable no-new-func */ var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;'); /* eslint-enable no-new-func */ - unsafeEval = func({ a: 'b' }, 'a', 'b') === true; } - catch (e) - { + catch (e) { unsafeEval = false; } - return unsafeEval; } @@ -25086,234 +23183,190 @@ var PIXI = (function (exports) { var defaultVertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n"; - // import * as from '../systems/shader/shader'; - var UID$3 = 0; - var nameCache = {}; - /** * Helper class to create a shader program. * * @class * @memberof PIXI */ - var Program = function Program(vertexSrc, fragmentSrc, name) - { - if ( name === void 0 ) { name = 'pixi-shader'; } - - this.id = UID$3++; - + var Program = /** @class */ (function () { /** - * The vertex shader. - * - * @member {string} + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name] - Name for shader */ - this.vertexSrc = vertexSrc || Program.defaultVertexSrc; - + function Program(vertexSrc, fragmentSrc, name) { + if (name === void 0) { name = 'pixi-shader'; } + this.id = UID$3++; + /** + * The vertex shader. + * + * @member {string} + */ + this.vertexSrc = vertexSrc || Program.defaultVertexSrc; + /** + * The fragment shader. + * + * @member {string} + */ + this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; + this.vertexSrc = this.vertexSrc.trim(); + this.fragmentSrc = this.fragmentSrc.trim(); + if (this.vertexSrc.substring(0, 8) !== '#version') { + name = name.replace(/\s+/g, '-'); + if (nameCache[name]) { + nameCache[name]++; + name += "-" + nameCache[name]; + } + else { + nameCache[name] = 1; + } + this.vertexSrc = "#define SHADER_NAME " + name + "\n" + this.vertexSrc; + this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + this.fragmentSrc; + this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, exports.PRECISION.HIGH); + this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); + } + // currently this does not extract structs only default types + this.extractData(this.vertexSrc, this.fragmentSrc); + // this is where we store shader references.. + this.glPrograms = {}; + this.syncUniforms = null; + } /** - * The fragment shader. + * Extracts the data for a buy creating a small test program + * or reading the src directly. + * @protected * - * @member {string} + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. */ - this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc; - - this.vertexSrc = this.vertexSrc.trim(); - this.fragmentSrc = this.fragmentSrc.trim(); - - if (this.vertexSrc.substring(0, 8) !== '#version') - { - name = name.replace(/\s+/g, '-'); - - if (nameCache[name]) - { - nameCache[name]++; - name += "-" + (nameCache[name]); + Program.prototype.extractData = function (vertexSrc, fragmentSrc) { + var gl = getTestContext(); + if (gl) { + var program = compileProgram(gl, vertexSrc, fragmentSrc); + this.attributeData = this.getAttributeData(program, gl); + this.uniformData = this.getUniformData(program, gl); + gl.deleteProgram(program); } - else - { - nameCache[name] = 1; + else { + this.uniformData = {}; + this.attributeData = {}; } - - this.vertexSrc = "#define SHADER_NAME " + name + "\n" + (this.vertexSrc); - this.fragmentSrc = "#define SHADER_NAME " + name + "\n" + (this.fragmentSrc); - - this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, exports.PRECISION.HIGH); - this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision()); - } - - // currently this does not extract structs only default types - this.extractData(this.vertexSrc, this.fragmentSrc); - - // this is where we store shader references.. - this.glPrograms = {}; - - this.syncUniforms = null; - }; - - var staticAccessors = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } }; - - /** - * Extracts the data for a buy creating a small test program - * or reading the src directly. - * @protected - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - */ - Program.prototype.extractData = function extractData (vertexSrc, fragmentSrc) - { - var gl = getTestContext(); - - if (gl) - { - var program = compileProgram(gl, vertexSrc, fragmentSrc); - - this.attributeData = this.getAttributeData(program, gl); - this.uniformData = this.getUniformData(program, gl); - - gl.deleteProgram(program); - } - else - { - this.uniformData = {}; - this.attributeData = {}; - } - }; - - /** - * returns the attribute data from the program - * @private - * - * @param {WebGLProgram} [program] - the WebGL program - * @param {WebGLRenderingContext} [gl] - the WebGL context - * - * @returns {object} the attribute data for this program - */ - Program.prototype.getAttributeData = function getAttributeData (program, gl) - { - var attributes = {}; - var attributesArray = []; - - var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - - for (var i = 0; i < totalAttributes; i++) - { - var attribData = gl.getActiveAttrib(program, i); - var type = mapType(gl, attribData.type); - - /*eslint-disable */ - var data = { - type: type, - name: attribData.name, - size: mapSize(type), - location: 0, - }; - /* eslint-enable */ - - attributes[attribData.name] = data; - attributesArray.push(data); - } - - attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow - - for (var i$1 = 0; i$1 < attributesArray.length; i$1++) - { - attributesArray[i$1].location = i$1; - } - - return attributes; - }; - - /** - * returns the uniform data from the program - * @private - * - * @param {webGL-program} [program] - the webgl program - * @param {context} [gl] - the WebGL context - * - * @returns {object} the uniform data for this program - */ - Program.prototype.getUniformData = function getUniformData (program, gl) - { - var uniforms = {}; - - var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - - // TODO expose this as a prop? - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); - - for (var i = 0; i < totalUniforms; i++) - { - var uniformData = gl.getActiveUniform(program, i); - var name = uniformData.name.replace(/\[.*?\]/, ''); - - var isArray = uniformData.name.match(/\[.*?\]/, ''); - var type = mapType(gl, uniformData.type); - - /*eslint-disable */ - uniforms[name] = { - type: type, - size: uniformData.size, - isArray:isArray, - value: defaultValue(type, uniformData.size), - }; - /* eslint-enable */ - } - - return uniforms; - }; - - /** - * The default vertex shader source - * - * @static - * @constant - * @member {string} - */ - staticAccessors.defaultVertexSrc.get = function () - { - return defaultVertex; - }; - - /** - * The default fragment shader source - * - * @static - * @constant - * @member {string} - */ - staticAccessors.defaultFragmentSrc.get = function () - { - return defaultFragment; - }; - - /** - * A short hand function to create a program based of a vertex and fragment shader - * this method will also check to see if there is a cached program. - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {string} [name=pixi-shader] - Name for shader - * - * @returns {PIXI.Program} an shiny new Pixi shader! - */ - Program.from = function from (vertexSrc, fragmentSrc, name) - { - var key = vertexSrc + fragmentSrc; - - var program = ProgramCache[key]; - - if (!program) - { - ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); - } - - return program; - }; - - Object.defineProperties( Program, staticAccessors ); + }; + /** + * returns the attribute data from the program + * @private + * + * @param {WebGLProgram} [program] - the WebGL program + * @param {WebGLRenderingContext} [gl] - the WebGL context + * + * @returns {object} the attribute data for this program + */ + Program.prototype.getAttributeData = function (program, gl) { + var attributes = {}; + var attributesArray = []; + var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); + for (var i = 0; i < totalAttributes; i++) { + var attribData = gl.getActiveAttrib(program, i); + var type = mapType(gl, attribData.type); + /*eslint-disable */ + var data = { + type: type, + name: attribData.name, + size: mapSize(type), + location: 0, + }; + /* eslint-enable */ + attributes[attribData.name] = data; + attributesArray.push(data); + } + attributesArray.sort(function (a, b) { return (a.name > b.name) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow + for (var i = 0; i < attributesArray.length; i++) { + attributesArray[i].location = i; + } + return attributes; + }; + /** + * returns the uniform data from the program + * @private + * + * @param {webGL-program} [program] - the webgl program + * @param {context} [gl] - the WebGL context + * + * @returns {object} the uniform data for this program + */ + Program.prototype.getUniformData = function (program, gl) { + var uniforms = {}; + var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + // TODO expose this as a prop? + // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); + // const maskRegex = new RegExp('^(projectionMatrix|uSampler|translationMatrix)$'); + for (var i = 0; i < totalUniforms; i++) { + var uniformData = gl.getActiveUniform(program, i); + var name = uniformData.name.replace(/\[.*?\]$/, ''); + var isArray = uniformData.name.match(/\[.*?\]$/); + var type = mapType(gl, uniformData.type); + /*eslint-disable */ + uniforms[name] = { + type: type, + size: uniformData.size, + isArray: isArray, + value: defaultValue(type, uniformData.size), + }; + /* eslint-enable */ + } + return uniforms; + }; + Object.defineProperty(Program, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @constant + * @member {string} + */ + get: function () { + return defaultVertex; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Program, "defaultFragmentSrc", { + /** + * The default fragment shader source + * + * @static + * @constant + * @member {string} + */ + get: function () { + return defaultFragment; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a program based of a vertex and fragment shader + * this method will also check to see if there is a cached program. + * + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {string} [name=pixi-shader] - Name for shader + * + * @returns {PIXI.Program} an shiny new Pixi shader! + */ + Program.from = function (vertexSrc, fragmentSrc, name) { + var key = vertexSrc + fragmentSrc; + var program = ProgramCache[key]; + if (!program) { + ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name); + } + return program; + }; + return Program; + }()); /** * A helper class for shaders @@ -25321,114 +23374,94 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Shader = function Shader(program, uniforms) - { + var Shader = /** @class */ (function () { /** - * Program that the shader uses - * - * @member {PIXI.Program} + * @param {PIXI.Program} [program] - The program the shader will use. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. */ - this.program = program; - - // lets see whats been passed in - // uniforms should be converted to a uniform group - if (uniforms) - { - if (uniforms instanceof UniformGroup) - { - this.uniformGroup = uniforms; + function Shader(program, uniforms) { + /** + * Program that the shader uses + * + * @member {PIXI.Program} + */ + this.program = program; + // lets see whats been passed in + // uniforms should be converted to a uniform group + if (uniforms) { + if (uniforms instanceof UniformGroup) { + this.uniformGroup = uniforms; + } + else { + this.uniformGroup = new UniformGroup(uniforms); + } } - else - { - this.uniformGroup = new UniformGroup(uniforms); + else { + this.uniformGroup = new UniformGroup({}); } - } - else - { - this.uniformGroup = new UniformGroup({}); - } - - // time to build some getters and setters! - // I guess down the line this could sort of generate an instruction list rather than use dirty ids? - // does the trick for now though! - for (var i in program.uniformData) - { - if (this.uniformGroup.uniforms[i] instanceof Array) - { - this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]); - } - } - }; - - var prototypeAccessors$2$1 = { uniforms: { configurable: true } }; - - // TODO move to shader system.. - Shader.prototype.checkUniformExists = function checkUniformExists (name, group) - { - if (group.uniforms[name]) - { - return true; - } - - for (var i in group.uniforms) - { - var uniform = group.uniforms[i]; - - if (uniform.group) - { - if (this.checkUniformExists(name, uniform)) - { - return true; + // time to build some getters and setters! + // I guess down the line this could sort of generate an instruction list rather than use dirty ids? + // does the trick for now though! + for (var i in program.uniformData) { + if (this.uniformGroup.uniforms[i] instanceof Array) { + this.uniformGroup.uniforms[i] = new Float32Array(this.uniformGroup.uniforms[i]); } } } - - return false; - }; - - Shader.prototype.destroy = function destroy () - { - // usage count on programs? - // remove if not used! - this.uniformGroup = null; - }; - - /** - * Shader uniform values, shortcut for `uniformGroup.uniforms` - * @readonly - * @member {object} - */ - prototypeAccessors$2$1.uniforms.get = function () - { - return this.uniformGroup.uniforms; - }; - - /** - * A short hand function to create a shader based of a vertex and fragment shader - * - * @param {string} [vertexSrc] - The source of the vertex shader. - * @param {string} [fragmentSrc] - The source of the fragment shader. - * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. - * - * @returns {PIXI.Shader} an shiny new Pixi shader! - */ - Shader.from = function from (vertexSrc, fragmentSrc, uniforms) - { - var program = Program.from(vertexSrc, fragmentSrc); - - return new Shader(program, uniforms); - }; - - Object.defineProperties( Shader.prototype, prototypeAccessors$2$1 ); + // TODO move to shader system.. + Shader.prototype.checkUniformExists = function (name, group) { + if (group.uniforms[name]) { + return true; + } + for (var i in group.uniforms) { + var uniform = group.uniforms[i]; + if (uniform.group) { + if (this.checkUniformExists(name, uniform)) { + return true; + } + } + } + return false; + }; + Shader.prototype.destroy = function () { + // usage count on programs? + // remove if not used! + this.uniformGroup = null; + }; + Object.defineProperty(Shader.prototype, "uniforms", { + /** + * Shader uniform values, shortcut for `uniformGroup.uniforms` + * @readonly + * @member {object} + */ + get: function () { + return this.uniformGroup.uniforms; + }, + enumerable: false, + configurable: true + }); + /** + * A short hand function to create a shader based of a vertex and fragment shader + * + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + * + * @returns {PIXI.Shader} an shiny new Pixi shader! + */ + Shader.from = function (vertexSrc, fragmentSrc, uniforms) { + var program = Program.from(vertexSrc, fragmentSrc); + return new Shader(program, uniforms); + }; + return Shader; + }()); /* eslint-disable max-len */ - var BLEND = 0; var OFFSET = 1; var CULLING = 2; var DEPTH_TEST = 3; var WINDING = 4; - /** * This is a WebGL state, and is is passed The WebGL StateManager. * @@ -25438,159 +23471,146 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var State = function State() - { - this.data = 0; - - this.blendMode = exports.BLEND_MODES.NORMAL; - this.polygonOffset = 0; - - this.blend = true; - // this.depthTest = true; - }; - - var prototypeAccessors$3 = { blend: { configurable: true },offsets: { configurable: true },culling: { configurable: true },depthTest: { configurable: true },clockwiseFrontFace: { configurable: true },blendMode: { configurable: true },polygonOffset: { configurable: true } }; - - /** - * Activates blending of the computed fragment color values - * - * @member {boolean} - */ - prototypeAccessors$3.blend.get = function () - { - return !!(this.data & (1 << BLEND)); - }; - - prototypeAccessors$3.blend.set = function (value) // eslint-disable-line require-jsdoc - { - if (!!(this.data & (1 << BLEND)) !== value) - { - this.data ^= (1 << BLEND); + var State = /** @class */ (function () { + function State() { + this.data = 0; + this.blendMode = exports.BLEND_MODES.NORMAL; + this.polygonOffset = 0; + this.blend = true; + // this.depthTest = true; } - }; - - /** - * Activates adding an offset to depth values of polygon's fragments - * - * @member {boolean} - * @default false - */ - prototypeAccessors$3.offsets.get = function () - { - return !!(this.data & (1 << OFFSET)); - }; - - prototypeAccessors$3.offsets.set = function (value) // eslint-disable-line require-jsdoc - { - if (!!(this.data & (1 << OFFSET)) !== value) - { - this.data ^= (1 << OFFSET); - } - }; - - /** - * Activates culling of polygons. - * - * @member {boolean} - * @default false - */ - prototypeAccessors$3.culling.get = function () - { - return !!(this.data & (1 << CULLING)); - }; - - prototypeAccessors$3.culling.set = function (value) // eslint-disable-line require-jsdoc - { - if (!!(this.data & (1 << CULLING)) !== value) - { - this.data ^= (1 << CULLING); - } - }; - - /** - * Activates depth comparisons and updates to the depth buffer. - * - * @member {boolean} - * @default false - */ - prototypeAccessors$3.depthTest.get = function () - { - return !!(this.data & (1 << DEPTH_TEST)); - }; - - prototypeAccessors$3.depthTest.set = function (value) // eslint-disable-line require-jsdoc - { - if (!!(this.data & (1 << DEPTH_TEST)) !== value) - { - this.data ^= (1 << DEPTH_TEST); - } - }; - - /** - * Specifies whether or not front or back-facing polygons can be culled. - * @member {boolean} - * @default false - */ - prototypeAccessors$3.clockwiseFrontFace.get = function () - { - return !!(this.data & (1 << WINDING)); - }; - - prototypeAccessors$3.clockwiseFrontFace.set = function (value) // eslint-disable-line require-jsdoc - { - if (!!(this.data & (1 << WINDING)) !== value) - { - this.data ^= (1 << WINDING); - } - }; - - /** - * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * Setting this mode to anything other than NO_BLEND will automatically switch blending on. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - * @see PIXI.BLEND_MODES - */ - prototypeAccessors$3.blendMode.get = function () - { - return this._blendMode; - }; - - prototypeAccessors$3.blendMode.set = function (value) // eslint-disable-line require-jsdoc - { - this.blend = (value !== exports.BLEND_MODES.NONE); - this._blendMode = value; - }; - - /** - * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. - * - * @member {number} - * @default 0 - */ - prototypeAccessors$3.polygonOffset.get = function () - { - return this._polygonOffset; - }; - - prototypeAccessors$3.polygonOffset.set = function (value) // eslint-disable-line require-jsdoc - { - this.offsets = !!value; - this._polygonOffset = value; - }; - - State.for2d = function for2d () - { - var state = new State(); - - state.depthTest = false; - state.blend = true; - - return state; - }; - - Object.defineProperties( State.prototype, prototypeAccessors$3 ); + Object.defineProperty(State.prototype, "blend", { + /** + * Activates blending of the computed fragment color values + * + * @member {boolean} + */ + get: function () { + return !!(this.data & (1 << BLEND)); + }, + set: function (value) { + if (!!(this.data & (1 << BLEND)) !== value) { + this.data ^= (1 << BLEND); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "offsets", { + /** + * Activates adding an offset to depth values of polygon's fragments + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << OFFSET)); + }, + set: function (value) { + if (!!(this.data & (1 << OFFSET)) !== value) { + this.data ^= (1 << OFFSET); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "culling", { + /** + * Activates culling of polygons. + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << CULLING)); + }, + set: function (value) { + if (!!(this.data & (1 << CULLING)) !== value) { + this.data ^= (1 << CULLING); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "depthTest", { + /** + * Activates depth comparisons and updates to the depth buffer. + * + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << DEPTH_TEST)); + }, + set: function (value) { + if (!!(this.data & (1 << DEPTH_TEST)) !== value) { + this.data ^= (1 << DEPTH_TEST); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "clockwiseFrontFace", { + /** + * Specifies whether or not front or back-facing polygons can be culled. + * @member {boolean} + * @default false + */ + get: function () { + return !!(this.data & (1 << WINDING)); + }, + set: function (value) { + if (!!(this.data & (1 << WINDING)) !== value) { + this.data ^= (1 << WINDING); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "blendMode", { + /** + * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * Setting this mode to anything other than NO_BLEND will automatically switch blending on. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + * @see PIXI.BLEND_MODES + */ + get: function () { + return this._blendMode; + }, + set: function (value) { + this.blend = (value !== exports.BLEND_MODES.NONE); + this._blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(State.prototype, "polygonOffset", { + /** + * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill. + * + * @member {number} + * @default 0 + */ + get: function () { + return this._polygonOffset; + }, + set: function (value) { + this.offsets = !!value; + this._polygonOffset = value; + }, + enumerable: false, + configurable: true + }); + State.for2d = function () { + var state = new State(); + state.depthTest = false; + state.blend = true; + return state; + }; + return State; + }()); var defaultVertex$1 = "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"; @@ -25732,14 +23752,17 @@ var PIXI = (function (exports) { * @memberof PIXI * @extends PIXI.Shader */ - var Filter = /*@__PURE__*/(function (Shader) { - function Filter(vertexSrc, fragmentSrc, uniforms) - { - var program = Program.from(vertexSrc || Filter.defaultVertexSrc, - fragmentSrc || Filter.defaultFragmentSrc); - - Shader.call(this, program, uniforms); - + var Filter = /** @class */ (function (_super) { + __extends$2(Filter, _super); + /** + * @param {string} [vertexSrc] - The source of the vertex shader. + * @param {string} [fragmentSrc] - The source of the fragment shader. + * @param {object} [uniforms] - Custom uniforms to use to augment the built-in ones. + */ + function Filter(vertexSrc, fragmentSrc, uniforms) { + var _this = this; + var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc); + _this = _super.call(this, program, uniforms) || this; /** * The padding of the filter. Some filters require extra space to breath such as a blur. * Increasing this will add extra width and height to the bounds of the object that the @@ -25747,133 +23770,108 @@ var PIXI = (function (exports) { * * @member {number} */ - this.padding = 0; - + _this.padding = 0; /** * The resolution of the filter. Setting this to be lower will lower the quality but * increase the performance of the filter. * * @member {number} */ - this.resolution = settings.FILTER_RESOLUTION; - + _this.resolution = settings.FILTER_RESOLUTION; /** * If enabled is true the filter is applied, if false it will not. * * @member {boolean} */ - this.enabled = true; - + _this.enabled = true; /** * If enabled, PixiJS will fit the filter area into boundaries for better performance. * Switch it off if it does not work for specific shader. * * @member {boolean} */ - this.autoFit = true; - + _this.autoFit = true; /** * Legacy filters use position and uvs from attributes * @member {boolean} * @readonly */ - this.legacy = !!this.program.attributeData.aTextureCoord; - + _this.legacy = !!_this.program.attributeData.aTextureCoord; /** * The WebGL state the filter requires to render * @member {PIXI.State} */ - this.state = new State(); + _this.state = new State(); + return _this; } - - if ( Shader ) { Filter.__proto__ = Shader; } - Filter.prototype = Object.create( Shader && Shader.prototype ); - Filter.prototype.constructor = Filter; - - var prototypeAccessors = { blendMode: { configurable: true } }; - var staticAccessors = { defaultVertexSrc: { configurable: true },defaultFragmentSrc: { configurable: true } }; - /** * Applies the filter * * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from * @param {PIXI.RenderTexture} input - The input render target. * @param {PIXI.RenderTexture} output - The target to output to. - * @param {boolean} clear - Should the output be cleared before rendering to it + * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. * @param {object} [currentState] - It's current state of filter. * There are some useful properties in the currentState : * target, filters, sourceFrame, destinationFrame, renderTarget, resolution */ - Filter.prototype.apply = function apply (filterManager, input, output, clear, currentState) - { + Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) { // do as you please! - - filterManager.applyFilter(this, input, output, clear, currentState); - + filterManager.applyFilter(this, input, output, clearMode); // or just do a regular render.. }; - - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - prototypeAccessors.blendMode.get = function () - { - return this.state.blendMode; - }; - - prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc - { - this.state.blendMode = value; - }; - - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - staticAccessors.defaultVertexSrc.get = function () - { - return defaultVertex$1; - }; - - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - staticAccessors.defaultFragmentSrc.get = function () - { - return defaultFragment$1; - }; - - Object.defineProperties( Filter.prototype, prototypeAccessors ); - Object.defineProperties( Filter, staticAccessors ); - + Object.defineProperty(Filter.prototype, "blendMode", { + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.state.blendMode; + }, + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultVertex$1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Filter, "defaultFragmentSrc", { + /** + * The default fragment shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultFragment$1; + }, + enumerable: false, + configurable: true + }); return Filter; }(Shader)); - /** - * Used for caching shader IDs - * - * @static - * @type {object} - * @protected - */ - Filter.SOURCE_KEY_MAP = {}; - var vertex = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n"; var fragment = "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"; var tempMat = new Matrix(); - /** * Class controls uv mapping from Texture normal space to BaseTexture normal space. * @@ -25891,169 +23889,148 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var TextureMatrix = function TextureMatrix(texture, clampMargin) - { - this._texture = texture; - + var TextureMatrix = /** @class */ (function () { /** - * Matrix operation that converts texture region coords to texture coords - * @member {PIXI.Matrix} - * @readonly - */ - this.mapCoord = new Matrix(); - - /** - * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampFrame = new Float32Array(4); - - /** - * Normalized clamp offset. - * Calculated based on clampOffset. - * @member {Float32Array} - * @readonly - */ - this.uClampOffset = new Float32Array(2); - - /** - * Tracks Texture frame changes - * @member {number} - * @protected - */ - this._updateID = -1; - - /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders * - * @default 0 - * @member {number} + * @param {PIXI.Texture} texture - observed texture + * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border. + * @constructor */ - this.clampOffset = 0; - + function TextureMatrix(texture, clampMargin) { + this._texture = texture; + /** + * Matrix operation that converts texture region coords to texture coords + * @member {PIXI.Matrix} + * @readonly + */ + this.mapCoord = new Matrix(); + /** + * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw. + * Calculated based on clampOffset. + * @member {Float32Array} + * @readonly + */ + this.uClampFrame = new Float32Array(4); + /** + * Normalized clamp offset. + * Calculated based on clampOffset. + * @member {Float32Array} + * @readonly + */ + this.uClampOffset = new Float32Array(2); + /** + * Tracks Texture frame changes + * @member {number} + * @protected + */ + this._textureID = -1; + /** + * Tracks Texture frame changes + * @member {number} + * @protected + */ + this._updateID = 0; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders + * + * @default 0 + * @member {number} + */ + this.clampOffset = 0; + /** + * Changes frame clamping + * Works with TilingSprite and Mesh + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; + /** + * If texture size is the same as baseTexture + * @member {boolean} + * @default false + * @readonly + */ + this.isSimple = false; + } + Object.defineProperty(TextureMatrix.prototype, "texture", { + /** + * texture property + * @member {PIXI.Texture} + */ + get: function () { + return this._texture; + }, + set: function (value) { + this._texture = value; + this._textureID = -1; + }, + enumerable: false, + configurable: true + }); /** - * Changes frame clamping - * Works with TilingSprite and Mesh - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} + * Multiplies uvs array to transform + * @param {Float32Array} uvs - mesh uvs + * @param {Float32Array} [out=uvs] output + * @returns {Float32Array} output */ - this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin; - + TextureMatrix.prototype.multiplyUvs = function (uvs, out) { + if (out === undefined) { + out = uvs; + } + var mat = this.mapCoord; + for (var i = 0; i < uvs.length; i += 2) { + var x = uvs[i]; + var y = uvs[i + 1]; + out[i] = (x * mat.a) + (y * mat.c) + mat.tx; + out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; + } + return out; + }; /** - * If texture size is the same as baseTexture - * @member {boolean} - * @default false - * @readonly + * updates matrices if texture was changed + * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case + * @returns {boolean} whether or not it was updated */ - this.isSimple = false; - }; - - var prototypeAccessors$4 = { texture: { configurable: true } }; - - /** - * texture property - * @member {PIXI.Texture} - */ - prototypeAccessors$4.texture.get = function () - { - return this._texture; - }; - - prototypeAccessors$4.texture.set = function (value) // eslint-disable-line require-jsdoc - { - this._texture = value; - this._updateID = -1; - }; - - /** - * Multiplies uvs array to transform - * @param {Float32Array} uvs mesh uvs - * @param {Float32Array} [out=uvs] output - * @returns {Float32Array} output - */ - TextureMatrix.prototype.multiplyUvs = function multiplyUvs (uvs, out) - { - if (out === undefined) - { - out = uvs; - } - - var mat = this.mapCoord; - - for (var i = 0; i < uvs.length; i += 2) - { - var x = uvs[i]; - var y = uvs[i + 1]; - - out[i] = (x * mat.a) + (y * mat.c) + mat.tx; - out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty; - } - - return out; - }; - - /** - * updates matrices if texture was changed - * @param {boolean} [forceUpdate=false] if true, matrices will be updated any case - * @returns {boolean} whether or not it was updated - */ - TextureMatrix.prototype.update = function update (forceUpdate) - { - var tex = this._texture; - - if (!tex || !tex.valid) - { - return false; - } - - if (!forceUpdate - && this._updateID === tex._updateID) - { - return false; - } - - this._updateID = tex._updateID; - - var uvs = tex._uvs; - - this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); - - var orig = tex.orig; - var trim = tex.trim; - - if (trim) - { - tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, - -trim.x / trim.width, -trim.y / trim.height); - this.mapCoord.append(tempMat); - } - - var texBase = tex.baseTexture; - var frame = this.uClampFrame; - var margin = this.clampMargin / texBase.resolution; - var offset = this.clampOffset; - - frame[0] = (tex._frame.x + margin + offset) / texBase.width; - frame[1] = (tex._frame.y + margin + offset) / texBase.height; - frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; - frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; - this.uClampOffset[0] = offset / texBase.realWidth; - this.uClampOffset[1] = offset / texBase.realHeight; - - this.isSimple = tex._frame.width === texBase.width - && tex._frame.height === texBase.height - && tex.rotate === 0; - - return true; - }; - - Object.defineProperties( TextureMatrix.prototype, prototypeAccessors$4 ); + TextureMatrix.prototype.update = function (forceUpdate) { + var tex = this._texture; + if (!tex || !tex.valid) { + return false; + } + if (!forceUpdate + && this._textureID === tex._updateID) { + return false; + } + this._textureID = tex._updateID; + this._updateID++; + var uvs = tex._uvs; + this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0); + var orig = tex.orig; + var trim = tex.trim; + if (trim) { + tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height); + this.mapCoord.append(tempMat); + } + var texBase = tex.baseTexture; + var frame = this.uClampFrame; + var margin = this.clampMargin / texBase.resolution; + var offset = this.clampOffset; + frame[0] = (tex._frame.x + margin + offset) / texBase.width; + frame[1] = (tex._frame.y + margin + offset) / texBase.height; + frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width; + frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height; + this.uClampOffset[0] = offset / texBase.realWidth; + this.uClampOffset[1] = offset / texBase.realHeight; + this.isSimple = tex._frame.width === texBase.width + && tex._frame.height === texBase.height + && tex.rotate === 0; + return true; + }; + return TextureMatrix; + }()); /** * This handles a Sprite acting as a mask, as opposed to a Graphic. @@ -26064,68 +24041,57 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI */ - var SpriteMaskFilter = /*@__PURE__*/(function (Filter) { - function SpriteMaskFilter(sprite) - { + var SpriteMaskFilter = /** @class */ (function (_super) { + __extends$2(SpriteMaskFilter, _super); + /** + * @param {PIXI.Sprite} sprite - the target sprite + */ + function SpriteMaskFilter(sprite) { + var _this = this; var maskMatrix = new Matrix(); - - Filter.call(this, vertex, fragment); - + _this = _super.call(this, vertex, fragment) || this; sprite.renderable = false; - /** * Sprite mask * @member {PIXI.Sprite} */ - this.maskSprite = sprite; - + _this.maskSprite = sprite; /** * Mask matrix * @member {PIXI.Matrix} */ - this.maskMatrix = maskMatrix; + _this.maskMatrix = maskMatrix; + return _this; } - - if ( Filter ) { SpriteMaskFilter.__proto__ = Filter; } - SpriteMaskFilter.prototype = Object.create( Filter && Filter.prototype ); - SpriteMaskFilter.prototype.constructor = SpriteMaskFilter; - /** * Applies the filter * * @param {PIXI.systems.FilterSystem} filterManager - The renderer to retrieve the filter from * @param {PIXI.RenderTexture} input - The input render target. * @param {PIXI.RenderTexture} output - The target to output to. - * @param {boolean} clear - Should the output be cleared before rendering to it. + * @param {PIXI.CLEAR_MODES} clearMode - Should the output be cleared before rendering to it. */ - SpriteMaskFilter.prototype.apply = function apply (filterManager, input, output, clear) - { + SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) { var maskSprite = this.maskSprite; - var tex = this.maskSprite.texture; - - if (!tex.valid) - { + var tex = maskSprite._texture; + if (!tex.valid) { return; } - if (!tex.transform) - { + if (!tex.uvMatrix) { // margin = 0.0, let it bleed a bit, shader code becomes easier // assuming that atlas textures were made with 1-pixel padding - tex.transform = new TextureMatrix(tex, 0.0); + tex.uvMatrix = new TextureMatrix(tex, 0.0); } - tex.transform.update(); - + tex.uvMatrix.update(); this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0; this.uniforms.mask = tex; // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend` this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite) - .prepend(tex.transform.mapCoord); + .prepend(tex.uvMatrix.mapCoord); this.uniforms.alpha = maskSprite.worldAlpha; - this.uniforms.maskClamp = tex.transform.uClampFrame; - - filterManager.applyFilter(this, input, output, clear); + this.uniforms.maskClamp = tex.uvMatrix.uClampFrame; + filterManager.applyFilter(this, input, output, clearMode); }; - return SpriteMaskFilter; }(Filter)); @@ -26136,66 +24102,51 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var MaskSystem = /*@__PURE__*/(function (System) { - function MaskSystem(renderer) - { - System.call(this, renderer); - - /** - * Target to mask - * @member {PIXI.DisplayObject} - * @readonly - */ - this.scissorRenderTarget = null; - + var MaskSystem = /** @class */ (function (_super) { + __extends$2(MaskSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function MaskSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * Enable scissor * @member {boolean} * @readonly */ - this.enableScissor = false; - + _this.enableScissor = false; /** * Pool of used sprite mask filters * @member {PIXI.SpriteMaskFilter[]} * @readonly */ - this.alphaMaskPool = []; - + _this.alphaMaskPool = []; /** * Pool of mask data * @member {PIXI.MaskData[]} * @readonly */ - this.maskDataPool = []; - - this.maskStack = []; - + _this.maskDataPool = []; + _this.maskStack = []; /** * Current index of alpha mask pool * @member {number} * @default 0 * @readonly */ - this.alphaMaskIndex = 0; + _this.alphaMaskIndex = 0; + return _this; } - - if ( System ) { MaskSystem.__proto__ = System; } - MaskSystem.prototype = Object.create( System && System.prototype ); - MaskSystem.prototype.constructor = MaskSystem; - /** * Changes the mask stack that is used by this System. * * @param {PIXI.MaskData[]} maskStack - The mask stack */ - MaskSystem.prototype.setMaskStack = function setMaskStack (maskStack) - { + MaskSystem.prototype.setMaskStack = function (maskStack) { this.maskStack = maskStack; this.renderer.scissor.setMaskStack(maskStack); this.renderer.stencil.setMaskStack(maskStack); }; - /** * Applies the Mask and adds it to the current filter stack. * Renderer batch must be flushed beforehand. @@ -26203,27 +24154,20 @@ var PIXI = (function (exports) { * @param {PIXI.DisplayObject} target - Display Object to push the mask to * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data. */ - MaskSystem.prototype.push = function push (target, maskData) - { - if (!maskData.isMaskData) - { + MaskSystem.prototype.push = function (target, maskDataOrTarget) { + var maskData = maskDataOrTarget; + if (!maskData.isMaskData) { var d = this.maskDataPool.pop() || new MaskData(); - d.pooled = true; - d.maskObject = maskData; + d.maskObject = maskDataOrTarget; maskData = d; } - - if (maskData.autoDetect) - { + if (maskData.autoDetect) { this.detect(maskData); } - maskData.copyCountersOrReset(this.maskStack[this.maskStack.length - 1]); maskData._target = target; - - switch (maskData.type) - { + switch (maskData.type) { case exports.MASK_TYPES.SCISSOR: this.maskStack.push(maskData); this.renderer.scissor.push(maskData); @@ -26241,26 +24185,19 @@ var PIXI = (function (exports) { break; } }; - /** * Removes the last mask from the mask stack and doesn't return it. * Renderer batch must be flushed beforehand. * * @param {PIXI.DisplayObject} target - Display Object to pop the mask from */ - MaskSystem.prototype.pop = function pop (target) - { + MaskSystem.prototype.pop = function (target) { var maskData = this.maskStack.pop(); - - if (!maskData || maskData._target !== target) - { + if (!maskData || maskData._target !== target) { // TODO: add an assert when we have it - return; } - - switch (maskData.type) - { + switch (maskData.type) { case exports.MASK_TYPES.SCISSOR: this.renderer.scissor.pop(); break; @@ -26273,94 +24210,68 @@ var PIXI = (function (exports) { default: break; } - maskData.reset(); - - if (maskData.pooled) - { + if (maskData.pooled) { this.maskDataPool.push(maskData); } }; - /** * Sets type of MaskData based on its maskObject * @param {PIXI.MaskData} maskData */ - MaskSystem.prototype.detect = function detect (maskData) - { + MaskSystem.prototype.detect = function (maskData) { var maskObject = maskData.maskObject; - - if (maskObject.isSprite) - { + if (maskObject.isSprite) { maskData.type = exports.MASK_TYPES.SPRITE; - return; } maskData.type = exports.MASK_TYPES.STENCIL; // detect scissor in graphics if (this.enableScissor && maskObject.isFastRect - && maskObject.isFastRect()) - { + && maskObject.isFastRect()) { var matrix = maskObject.worldTransform; - // TODO: move the check to the matrix itself // we are checking that its orthogonal and x rotation is 0 90 180 or 270 - var rotX = Math.atan2(matrix.b, matrix.a); var rotXY = Math.atan2(matrix.d, matrix.c); - // use the nearest degree to 0.01 rotX = Math.round(rotX * (180 / Math.PI) * 100); rotXY = Math.round(rotXY * (180 / Math.PI) * 100) - rotX; - rotX = ((rotX % 9000) + 9000) % 9000; rotXY = ((rotXY % 18000) + 18000) % 18000; - - if (rotX === 0 && rotXY === 9000) - { + if (rotX === 0 && rotXY === 9000) { maskData.type = exports.MASK_TYPES.SCISSOR; } } }; - /** * Applies the Mask and adds it to the current filter stack. * * @param {PIXI.MaskData} maskData - Sprite to be used as the mask */ - MaskSystem.prototype.pushSpriteMask = function pushSpriteMask (maskData) - { + MaskSystem.prototype.pushSpriteMask = function (maskData) { var maskObject = maskData.maskObject; var target = maskData._target; var alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex]; - - if (!alphaMaskFilter) - { + if (!alphaMaskFilter) { alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter(maskObject)]; } - alphaMaskFilter[0].resolution = this.renderer.resolution; alphaMaskFilter[0].maskSprite = maskObject; - var stashFilterArea = target.filterArea; - target.filterArea = maskObject.getBounds(true); this.renderer.filter.push(target, alphaMaskFilter); target.filterArea = stashFilterArea; - this.alphaMaskIndex++; }; - /** * Removes the last filter from the filter stack and doesn't return it. */ - MaskSystem.prototype.popSpriteMask = function popSpriteMask () - { + MaskSystem.prototype.popSpriteMask = function () { this.renderer.filter.pop(); this.alphaMaskIndex--; }; - return MaskSystem; }(System)); @@ -26371,87 +24282,68 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var AbstractMaskSystem = /*@__PURE__*/(function (System) { - function AbstractMaskSystem(renderer) - { - System.call(this, renderer); - + var AbstractMaskSystem = /** @class */ (function (_super) { + __extends$2(AbstractMaskSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function AbstractMaskSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * The mask stack * @member {PIXI.MaskData[]} */ - this.maskStack = []; - + _this.maskStack = []; /** * Constant for gl.enable * @member {number} * @private */ - this.glConst = 0; + _this.glConst = 0; + return _this; } - - if ( System ) { AbstractMaskSystem.__proto__ = System; } - AbstractMaskSystem.prototype = Object.create( System && System.prototype ); - AbstractMaskSystem.prototype.constructor = AbstractMaskSystem; - /** * gets count of masks of certain type * @returns {number} */ - AbstractMaskSystem.prototype.getStackLength = function getStackLength () - { + AbstractMaskSystem.prototype.getStackLength = function () { return this.maskStack.length; }; - /** * Changes the mask stack that is used by this System. * * @param {PIXI.MaskData[]} maskStack - The mask stack */ - AbstractMaskSystem.prototype.setMaskStack = function setMaskStack (maskStack) - { - var ref = this.renderer; - var gl = ref.gl; + AbstractMaskSystem.prototype.setMaskStack = function (maskStack) { + var gl = this.renderer.gl; var curStackLen = this.getStackLength(); - this.maskStack = maskStack; - var newStackLen = this.getStackLength(); - - if (newStackLen !== curStackLen) - { - if (newStackLen === 0) - { + if (newStackLen !== curStackLen) { + if (newStackLen === 0) { gl.disable(this.glConst); } - else - { + else { gl.enable(this.glConst); this._useCurrent(); } } }; - /** * Setup renderer to use the current mask data. * @private */ - AbstractMaskSystem.prototype._useCurrent = function _useCurrent () - { + AbstractMaskSystem.prototype._useCurrent = function () { // OVERWRITE; }; - /** * Destroys the mask stack. * */ - AbstractMaskSystem.prototype.destroy = function destroy () - { - System.prototype.destroy.call(this, this); - + AbstractMaskSystem.prototype.destroy = function () { + _super.prototype.destroy.call(this); this.maskStack = null; }; - return AbstractMaskSystem; }(System)); @@ -26462,112 +24354,80 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var ScissorSystem = /*@__PURE__*/(function (AbstractMaskSystem) { - function ScissorSystem(renderer) - { - AbstractMaskSystem.call(this, renderer); - - this.glConst = WebGLRenderingContext.SCISSOR_TEST; + var ScissorSystem = /** @class */ (function (_super) { + __extends$2(ScissorSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ScissorSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = WebGLRenderingContext.SCISSOR_TEST; + return _this; } - - if ( AbstractMaskSystem ) { ScissorSystem.__proto__ = AbstractMaskSystem; } - ScissorSystem.prototype = Object.create( AbstractMaskSystem && AbstractMaskSystem.prototype ); - ScissorSystem.prototype.constructor = ScissorSystem; - - ScissorSystem.prototype.getStackLength = function getStackLength () - { + ScissorSystem.prototype.getStackLength = function () { var maskData = this.maskStack[this.maskStack.length - 1]; - - if (maskData) - { + if (maskData) { return maskData._scissorCounter; } - return 0; }; - /** * Applies the Mask and adds it to the current stencil stack. @alvin * * @param {PIXI.MaskData} maskData - The mask data */ - ScissorSystem.prototype.push = function push (maskData) - { + ScissorSystem.prototype.push = function (maskData) { var maskObject = maskData.maskObject; - maskObject.renderable = true; - var prevData = maskData._scissorRect; var bounds = maskObject.getBounds(true); - var ref = this.renderer; - var gl = ref.gl; - + var gl = this.renderer.gl; maskObject.renderable = false; - - if (prevData) - { + if (prevData) { bounds.fit(prevData); } - else - { + else { gl.enable(gl.SCISSOR_TEST); } - maskData._scissorCounter++; maskData._scissorRect = bounds; this._useCurrent(); }; - /** * Pops scissor mask. MaskData is already removed from stack */ - ScissorSystem.prototype.pop = function pop () - { - var ref = this.renderer; - var gl = ref.gl; - - if (this.getStackLength() > 0) - { + ScissorSystem.prototype.pop = function () { + var gl = this.renderer.gl; + if (this.getStackLength() > 0) { this._useCurrent(); } - else - { + else { gl.disable(gl.SCISSOR_TEST); } }; - /** * Setup renderer to use the current scissor data. * @private */ - ScissorSystem.prototype._useCurrent = function _useCurrent () - { + ScissorSystem.prototype._useCurrent = function () { var rect = this.maskStack[this.maskStack.length - 1]._scissorRect; var rt = this.renderer.renderTexture.current; - var ref = this.renderer.projection; - var transform = ref.transform; - var sourceFrame = ref.sourceFrame; - var destinationFrame = ref.destinationFrame; + var _a = this.renderer.projection, transform = _a.transform, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; var resolution = rt ? rt.resolution : this.renderer.resolution; var x = ((rect.x - sourceFrame.x) * resolution) + destinationFrame.x; var y = ((rect.y - sourceFrame.y) * resolution) + destinationFrame.y; var width = rect.width * resolution; var height = rect.height * resolution; - - if (transform) - { + if (transform) { x += transform.tx * resolution; y += transform.ty * resolution; } - if (!rt) - { + if (!rt) { // flipY. In future we'll have it over renderTextures as an option y = this.renderer.height - height - y; } - this.renderer.gl.scissor(x, y, width, height); }; - return ScissorSystem; }(AbstractMaskSystem)); @@ -26578,118 +24438,90 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var StencilSystem = /*@__PURE__*/(function (AbstractMaskSystem) { - function StencilSystem(renderer) - { - AbstractMaskSystem.call(this, renderer); - - this.glConst = WebGLRenderingContext.STENCIL_TEST; + var StencilSystem = /** @class */ (function (_super) { + __extends$2(StencilSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function StencilSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.glConst = WebGLRenderingContext.STENCIL_TEST; + return _this; } - - if ( AbstractMaskSystem ) { StencilSystem.__proto__ = AbstractMaskSystem; } - StencilSystem.prototype = Object.create( AbstractMaskSystem && AbstractMaskSystem.prototype ); - StencilSystem.prototype.constructor = StencilSystem; - - StencilSystem.prototype.getStackLength = function getStackLength () - { + StencilSystem.prototype.getStackLength = function () { var maskData = this.maskStack[this.maskStack.length - 1]; - - if (maskData) - { + if (maskData) { return maskData._stencilCounter; } - return 0; }; - /** * Applies the Mask and adds it to the current stencil stack. * * @param {PIXI.MaskData} maskData - The mask data */ - StencilSystem.prototype.push = function push (maskData) - { + StencilSystem.prototype.push = function (maskData) { var maskObject = maskData.maskObject; - var ref = this.renderer; - var gl = ref.gl; + var gl = this.renderer.gl; var prevMaskCount = maskData._stencilCounter; - - if (prevMaskCount === 0) - { + if (prevMaskCount === 0) { // force use stencil texture in current framebuffer this.renderer.framebuffer.forceStencil(); gl.enable(gl.STENCIL_TEST); } - maskData._stencilCounter++; - // Increment the reference stencil value where the new mask overlaps with the old ones. gl.colorMask(false, false, false, false); gl.stencilFunc(gl.EQUAL, prevMaskCount, this._getBitwiseMask()); gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR); - maskObject.renderable = true; maskObject.render(this.renderer); this.renderer.batch.flush(); maskObject.renderable = false; - this._useCurrent(); }; - /** * Pops stencil mask. MaskData is already removed from stack * * @param {PIXI.DisplayObject} maskObject - object of popped mask data */ - StencilSystem.prototype.pop = function pop (maskObject) - { + StencilSystem.prototype.pop = function (maskObject) { var gl = this.renderer.gl; - - if (this.getStackLength() === 0) - { + if (this.getStackLength() === 0) { // the stack is empty! gl.disable(gl.STENCIL_TEST); gl.clear(gl.STENCIL_BUFFER_BIT); gl.clearStencil(0); } - else - { + else { // Decrement the reference stencil value where the popped mask overlaps with the other ones gl.colorMask(false, false, false, false); gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR); - maskObject.renderable = true; maskObject.render(this.renderer); this.renderer.batch.flush(); maskObject.renderable = false; - this._useCurrent(); } }; - /** * Setup renderer to use the current stencil data. * @private */ - StencilSystem.prototype._useCurrent = function _useCurrent () - { + StencilSystem.prototype._useCurrent = function () { var gl = this.renderer.gl; - gl.colorMask(true, true, true, true); gl.stencilFunc(gl.EQUAL, this.getStackLength(), this._getBitwiseMask()); gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); }; - /** * Fill 1s equal to the number of acitve stencil masks. * @private * @return {number} The bitwise mask. */ - StencilSystem.prototype._getBitwiseMask = function _getBitwiseMask () - { + StencilSystem.prototype._getBitwiseMask = function () { return (1 << this.getStackLength()) - 1; }; - return StencilSystem; }(AbstractMaskSystem)); @@ -26700,85 +24532,72 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - - var ProjectionSystem = /*@__PURE__*/(function (System) { - function ProjectionSystem(renderer) - { - System.call(this, renderer); - + var ProjectionSystem = /** @class */ (function (_super) { + __extends$2(ProjectionSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ProjectionSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * Destination frame * @member {PIXI.Rectangle} * @readonly */ - this.destinationFrame = null; - + _this.destinationFrame = null; /** * Source frame * @member {PIXI.Rectangle} * @readonly */ - this.sourceFrame = null; - + _this.sourceFrame = null; /** * Default destination frame * @member {PIXI.Rectangle} * @readonly */ - this.defaultFrame = null; - + _this.defaultFrame = null; /** * Project matrix * @member {PIXI.Matrix} * @readonly */ - this.projectionMatrix = new Matrix(); - + _this.projectionMatrix = new Matrix(); /** * A transform that will be appended to the projection matrix * if null, nothing will be applied * @member {PIXI.Matrix} */ - this.transform = null; + _this.transform = null; + return _this; } - - if ( System ) { ProjectionSystem.__proto__ = System; } - ProjectionSystem.prototype = Object.create( System && System.prototype ); - ProjectionSystem.prototype.constructor = ProjectionSystem; - /** - * Updates the projection matrix based on a projection frame (which is a rectangle) + * Updates the projection matrix based on a projection frame (which is a rectangle). + * + * Make sure to run `renderer.framebuffer.setViewport(destinationFrame)` after calling this. * * @param {PIXI.Rectangle} destinationFrame - The destination frame. * @param {PIXI.Rectangle} sourceFrame - The source frame. * @param {Number} resolution - Resolution * @param {boolean} root - If is root */ - ProjectionSystem.prototype.update = function update (destinationFrame, sourceFrame, resolution, root) - { + ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) { this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame; this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame; - + // Calculate object-space to clip-space projection this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root); - - if (this.transform) - { + if (this.transform) { this.projectionMatrix.append(this.transform); } - - var renderer = this.renderer; - + var renderer = this.renderer; renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix; renderer.globalUniforms.update(); - // this will work for now // but would be sweet to stick and even on the global uniforms.. - if (renderer.shader.shader) - { + if (renderer.shader.shader) { renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals); } }; - /** * Updates the projection matrix based on a projection frame (which is a rectangle) * @@ -26787,46 +24606,32 @@ var PIXI = (function (exports) { * @param {Number} resolution - Resolution * @param {boolean} root - If is root */ - ProjectionSystem.prototype.calculateProjection = function calculateProjection (destinationFrame, sourceFrame, resolution, root) - { + ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) { var pm = this.projectionMatrix; - - // I don't think we will need this line.. - // pm.identity(); - - if (!root) - { - pm.a = (1 / destinationFrame.width * 2) * resolution; - pm.d = (1 / destinationFrame.height * 2) * resolution; - - pm.tx = -1 - (sourceFrame.x * pm.a); - pm.ty = -1 - (sourceFrame.y * pm.d); - } - else - { - pm.a = (1 / destinationFrame.width * 2) * resolution; - pm.d = (-1 / destinationFrame.height * 2) * resolution; - - pm.tx = -1 - (sourceFrame.x * pm.a); - pm.ty = 1 - (sourceFrame.y * pm.d); - } + var sign = !root ? 1 : -1; + pm.identity(); + pm.a = (1 / sourceFrame.width * 2); + pm.d = sign * (1 / sourceFrame.height * 2); + pm.tx = -1 - (sourceFrame.x * pm.a); + pm.ty = -sign - (sourceFrame.y * pm.d); }; - /** * Sets the transform of the active render target to the given matrix * * @param {PIXI.Matrix} matrix - The transformation matrix */ - ProjectionSystem.prototype.setTransform = function setTransform ()// matrix) - { + ProjectionSystem.prototype.setTransform = function (_matrix) { // this._activeRenderTarget.transform = matrix; }; - return ProjectionSystem; }(System)); + // Temporary rectangle for assigned sourceFrame or destinationFrame var tempRect = new Rectangle(); - + // Temporary rectangle for renderTexture destinationFrame + var tempRect2 = new Rectangle(); + // Temporary rectangle for passing the framebuffer viewport + var viewportFrame = new Rectangle(); /** * System plugin to the renderer to manage render textures. * @@ -26836,214 +24641,187 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - - var RenderTextureSystem = /*@__PURE__*/(function (System) { - function RenderTextureSystem(renderer) - { - System.call(this, renderer); - + var RenderTextureSystem = /** @class */ (function (_super) { + __extends$2(RenderTextureSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function RenderTextureSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * The clear background color as rgba * @member {number[]} */ - this.clearColor = renderer._backgroundColorRgba; - + _this.clearColor = renderer._backgroundColorRgba; // TODO move this property somewhere else! /** * List of masks for the StencilSystem * @member {PIXI.Graphics[]} * @readonly */ - this.defaultMaskStack = []; - + _this.defaultMaskStack = []; // empty render texture? /** * Render texture * @member {PIXI.RenderTexture} * @readonly */ - this.current = null; - + _this.current = null; /** * Source frame * @member {PIXI.Rectangle} * @readonly */ - this.sourceFrame = new Rectangle(); - + _this.sourceFrame = new Rectangle(); /** * Destination frame * @member {PIXI.Rectangle} * @readonly */ - this.destinationFrame = new Rectangle(); + _this.destinationFrame = new Rectangle(); + return _this; } - - if ( System ) { RenderTextureSystem.__proto__ = System; } - RenderTextureSystem.prototype = Object.create( System && System.prototype ); - RenderTextureSystem.prototype.constructor = RenderTextureSystem; - /** * Bind the current render texture + * * @param {PIXI.RenderTexture} [renderTexture] - RenderTexture to bind, by default its `null`, the screen * @param {PIXI.Rectangle} [sourceFrame] - part of screen that is mapped to the renderTexture * @param {PIXI.Rectangle} [destinationFrame] - part of renderTexture, by default it has the same size as sourceFrame */ - RenderTextureSystem.prototype.bind = function bind (renderTexture, sourceFrame, destinationFrame) - { - if ( renderTexture === void 0 ) { renderTexture = null; } - - this.current = renderTexture; - + RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) { + if (renderTexture === void 0) { renderTexture = null; } var renderer = this.renderer; - + this.current = renderTexture; + var baseTexture; + var framebuffer; var resolution; - - if (renderTexture) - { - var baseTexture = renderTexture.baseTexture; - + if (renderTexture) { + baseTexture = renderTexture.baseTexture; resolution = baseTexture.resolution; - - if (!destinationFrame) - { - tempRect.width = baseTexture.realWidth; - tempRect.height = baseTexture.realHeight; - + if (!sourceFrame) { + tempRect.width = renderTexture.frame.width; + tempRect.height = renderTexture.frame.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { + tempRect2.x = renderTexture.frame.x; + tempRect2.y = renderTexture.frame.y; + tempRect2.width = sourceFrame.width; + tempRect2.height = sourceFrame.height; + destinationFrame = tempRect2; + } + framebuffer = baseTexture.framebuffer; + } + else { + resolution = renderer.resolution; + if (!sourceFrame) { + tempRect.width = renderer.screen.width; + tempRect.height = renderer.screen.height; + sourceFrame = tempRect; + } + if (!destinationFrame) { destinationFrame = tempRect; + destinationFrame.width = sourceFrame.width; + destinationFrame.height = sourceFrame.height; } - - if (!sourceFrame) - { - sourceFrame = destinationFrame; - } - - this.renderer.framebuffer.bind(baseTexture.framebuffer, destinationFrame); - - this.renderer.projection.update(destinationFrame, sourceFrame, resolution, false); + } + viewportFrame.x = destinationFrame.x * resolution; + viewportFrame.y = destinationFrame.y * resolution; + viewportFrame.width = destinationFrame.width * resolution; + viewportFrame.height = destinationFrame.height * resolution; + this.renderer.framebuffer.bind(framebuffer, viewportFrame); + this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer); + if (renderTexture) { this.renderer.mask.setMaskStack(baseTexture.maskStack); } - else - { - resolution = this.renderer.resolution; - - // TODO these validation checks happen deeper down.. - // thing they can be avoided.. - if (!destinationFrame) - { - tempRect.width = renderer.width; - tempRect.height = renderer.height; - - destinationFrame = tempRect; - } - - if (!sourceFrame) - { - sourceFrame = destinationFrame; - } - - renderer.framebuffer.bind(null, destinationFrame); - - // TODO store this.. - this.renderer.projection.update(destinationFrame, sourceFrame, resolution, true); + else { this.renderer.mask.setMaskStack(this.defaultMaskStack); } - this.sourceFrame.copyFrom(sourceFrame); - - this.destinationFrame.x = destinationFrame.x / resolution; - this.destinationFrame.y = destinationFrame.y / resolution; - - this.destinationFrame.width = destinationFrame.width / resolution; - this.destinationFrame.height = destinationFrame.height / resolution; - - if (sourceFrame === destinationFrame) - { - this.sourceFrame.copyFrom(this.destinationFrame); - } + this.destinationFrame.copyFrom(destinationFrame); }; - /** * Erases the render texture and fills the drawing area with a colour * * @param {number[]} [clearColor] - The color as rgba, default to use the renderer backgroundColor + * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks + * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers. * @return {PIXI.Renderer} Returns itself. */ - RenderTextureSystem.prototype.clear = function clear (clearColor) - { - if (this.current) - { + RenderTextureSystem.prototype.clear = function (clearColor, mask) { + if (this.current) { clearColor = clearColor || this.current.baseTexture.clearColor; } - else - { + else { clearColor = clearColor || this.clearColor; } - - this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); + this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask); }; - - RenderTextureSystem.prototype.resize = function resize ()// screenWidth, screenHeight) - { + RenderTextureSystem.prototype.resize = function () { // resize the root only! this.bind(null); }; - /** * Resets renderTexture state */ - RenderTextureSystem.prototype.reset = function reset () - { + RenderTextureSystem.prototype.reset = function () { this.bind(null); }; - return RenderTextureSystem; }(System)); + var IGLUniformData = /** @class */ (function () { + function IGLUniformData() { + } + return IGLUniformData; + }()); /** * Helper class to create a WebGL Program * * @class * @memberof PIXI */ - var GLProgram = function GLProgram(program, uniformData) - { + var GLProgram = /** @class */ (function () { /** - * The shader program + * Makes a new Pixi program * - * @member {WebGLProgram} + * @param program {WebGLProgram} webgl program + * @param uniformData {Object} uniforms */ - this.program = program; - + function GLProgram(program, uniformData) { + /** + * The shader program + * + * @member {WebGLProgram} + */ + this.program = program; + /** + * holds the uniform data which contains uniform locations + * and current uniform values used for caching and preventing unneeded GPU commands + * @member {Object} + */ + this.uniformData = uniformData; + /** + * uniformGroups holds the various upload functions for the shader. Each uniform group + * and program have a unique upload function generated. + * @member {Object} + */ + this.uniformGroups = {}; + } /** - * holds the uniform data which contains uniform locations - * and current uniform values used for caching and preventing unneeded GPU commands - * @member {Object} + * Destroys this program */ - this.uniformData = uniformData; - - /** - * uniformGroups holds the various upload functions for the shader. Each uniform group - * and program have a unique upload function generated. - * @member {Object} - */ - this.uniformGroups = {}; - }; - - /** - * Destroys this program - */ - GLProgram.prototype.destroy = function destroy () - { - this.uniformData = null; - this.uniformGroups = null; - this.program = null; - }; + GLProgram.prototype.destroy = function () { + this.uniformData = null; + this.uniformGroups = null; + this.program = null; + }; + return GLProgram; + }()); var UID$4 = 0; // defualt sync data so we don't create a new one each time! var defaultSyncData = { textureCount: 0 }; - /** * System plugin to the renderer to manage shaders. * @@ -27051,251 +24829,187 @@ var PIXI = (function (exports) { * @memberof PIXI.systems * @extends PIXI.System */ - var ShaderSystem = /*@__PURE__*/(function (System) { - function ShaderSystem(renderer) - { - System.call(this, renderer); - + var ShaderSystem = /** @class */ (function (_super) { + __extends$2(ShaderSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function ShaderSystem(renderer) { + var _this = _super.call(this, renderer) || this; + _this.destroyed = false; // Validation check that this environment support `new Function` - this.systemCheck(); - + _this.systemCheck(); /** * The current WebGL rendering context * * @member {WebGLRenderingContext} */ - this.gl = null; - - this.shader = null; - this.program = null; - + _this.gl = null; + _this.shader = null; + _this.program = null; /** * Cache to holds the generated functions. Stored against UniformObjects unique signature * @type {Object} * @private */ - this.cache = {}; - - this.id = UID$4++; + _this.cache = {}; + _this.id = UID$4++; + return _this; } - - if ( System ) { ShaderSystem.__proto__ = System; } - ShaderSystem.prototype = Object.create( System && System.prototype ); - ShaderSystem.prototype.constructor = ShaderSystem; - /** * Overrideable function by `@pixi/unsafe-eval` to silence * throwing an error if platform doesn't support unsafe-evals. * * @private */ - ShaderSystem.prototype.systemCheck = function systemCheck () - { - if (!unsafeEvalSupported()) - { + ShaderSystem.prototype.systemCheck = function () { + if (!unsafeEvalSupported()) { throw new Error('Current environment does not allow unsafe-eval, ' + 'please use @pixi/unsafe-eval module to enable support.'); } }; - - ShaderSystem.prototype.contextChange = function contextChange (gl) - { + ShaderSystem.prototype.contextChange = function (gl) { this.gl = gl; this.reset(); }; - /** * Changes the current shader to the one given in parameter * * @param {PIXI.Shader} shader - the new shader - * @param {boolean} dontSync - false if the shader should automatically sync its uniforms. + * @param {boolean} [dontSync] - false if the shader should automatically sync its uniforms. * @returns {PIXI.GLProgram} the glProgram that belongs to the shader. */ - ShaderSystem.prototype.bind = function bind (shader, dontSync) - { + ShaderSystem.prototype.bind = function (shader, dontSync) { shader.uniforms.globals = this.renderer.globalUniforms; - var program = shader.program; var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(shader); - this.shader = shader; - // TODO - some current Pixi plugins bypass this.. so it not safe to use yet.. - if (this.program !== program) - { + if (this.program !== program) { this.program = program; this.gl.useProgram(glProgram.program); } - - if (!dontSync) - { + if (!dontSync) { defaultSyncData.textureCount = 0; - this.syncUniformGroup(shader.uniformGroup, defaultSyncData); } - return glProgram; }; - /** * Uploads the uniforms values to the currently bound shader. * * @param {object} uniforms - the uniforms values that be applied to the current shader */ - ShaderSystem.prototype.setUniforms = function setUniforms (uniforms) - { + ShaderSystem.prototype.setUniforms = function (uniforms) { var shader = this.shader.program; var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID]; - shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer); }; - + /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /** * * syncs uniforms on the group - * @param {*} group the uniform group to sync - * @param {*} syncData this is data that is passed to the sync function and any nested sync functions + * @param {*} group - the uniform group to sync + * @param {*} [syncData] - this is data that is passed to the sync function and any nested sync functions */ - ShaderSystem.prototype.syncUniformGroup = function syncUniformGroup (group, syncData) - { + ShaderSystem.prototype.syncUniformGroup = function (group, syncData) { var glProgram = this.getglProgram(); - - if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) - { + if (!group.static || group.dirtyId !== glProgram.uniformGroups[group.id]) { glProgram.uniformGroups[group.id] = group.dirtyId; - this.syncUniforms(group, glProgram, syncData); } }; - /** * Overrideable by the @pixi/unsafe-eval package to use static * syncUnforms instead. * * @private */ - ShaderSystem.prototype.syncUniforms = function syncUniforms (group, glProgram, syncData) - { + ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) { var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group); - syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData); }; - - ShaderSystem.prototype.createSyncGroups = function createSyncGroups (group) - { + /* eslint-enable @typescript-eslint/explicit-module-boundary-types */ + ShaderSystem.prototype.createSyncGroups = function (group) { var id = this.getSignature(group, this.shader.program.uniformData); - - if (!this.cache[id]) - { + if (!this.cache[id]) { this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData); } - group.syncUniforms[this.shader.program.id] = this.cache[id]; - return group.syncUniforms[this.shader.program.id]; }; - /** * Takes a uniform group and data and generates a unique signature for them. * - * @param {PIXI.UniformGroup} group the uniform group to get signature of - * @param {Object} uniformData uniform information generated by the shader + * @param {PIXI.UniformGroup} group - the uniform group to get signature of + * @param {Object} uniformData - uniform information generated by the shader * @returns {String} Unique signature of the uniform group * @private */ - ShaderSystem.prototype.getSignature = function getSignature (group, uniformData) - { + ShaderSystem.prototype.getSignature = function (group, uniformData) { var uniforms = group.uniforms; - var strings = []; - - for (var i in uniforms) - { + for (var i in uniforms) { strings.push(i); - - if (uniformData[i]) - { + if (uniformData[i]) { strings.push(uniformData[i].type); } } - return strings.join('-'); }; - /** * Returns the underlying GLShade rof the currently bound shader. * This can be handy for when you to have a little more control over the setting of your uniforms. * * @return {PIXI.GLProgram} the glProgram for the currently bound Shader for this context */ - ShaderSystem.prototype.getglProgram = function getglProgram () - { - if (this.shader) - { + ShaderSystem.prototype.getglProgram = function () { + if (this.shader) { return this.shader.program.glPrograms[this.renderer.CONTEXT_UID]; } - return null; }; - /** * Generates a glProgram version of the Shader provided. * * @private - * @param {PIXI.Shader} shader the shader that the glProgram will be based on. + * @param {PIXI.Shader} shader - the shader that the glProgram will be based on. * @return {PIXI.GLProgram} A shiny new glProgram! */ - ShaderSystem.prototype.generateShader = function generateShader (shader) - { + ShaderSystem.prototype.generateShader = function (shader) { var gl = this.gl; - var program = shader.program; - var attribMap = {}; - - for (var i in program.attributeData) - { + for (var i in program.attributeData) { attribMap[i] = program.attributeData[i].location; } - var shaderProgram = compileProgram(gl, program.vertexSrc, program.fragmentSrc, attribMap); var uniformData = {}; - - for (var i$1 in program.uniformData) - { - var data = program.uniformData[i$1]; - - uniformData[i$1] = { - location: gl.getUniformLocation(shaderProgram, i$1), + for (var i in program.uniformData) { + var data = program.uniformData[i]; + uniformData[i] = { + location: gl.getUniformLocation(shaderProgram, i), value: defaultValue(data.type, data.size), }; } - var glProgram = new GLProgram(shaderProgram, uniformData); - program.glPrograms[this.renderer.CONTEXT_UID] = glProgram; - return glProgram; }; - /** * Resets ShaderSystem state, does not affect WebGL state */ - ShaderSystem.prototype.reset = function reset () - { + ShaderSystem.prototype.reset = function () { this.program = null; this.shader = null; }; - /** * Destroys this System and removes all its textures */ - ShaderSystem.prototype.destroy = function destroy () - { + ShaderSystem.prototype.destroy = function () { // TODO implement destroy method for ShaderSystem this.destroyed = true; }; - return ShaderSystem; }(System)); @@ -27309,10 +25023,8 @@ var PIXI = (function (exports) { * @param {number[][]} [array=[]] - The array to output into. * @return {number[][]} Mapped modes. */ - function mapWebGLBlendModesToPixi(gl, array) - { - if ( array === void 0 ) { array = []; } - + function mapWebGLBlendModesToPixi(gl, array) { + if (array === void 0) { array = []; } // TODO - premultiply alpha would be different. // add a boolean for that! array[exports.BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; @@ -27333,12 +25045,10 @@ var PIXI = (function (exports) { array[exports.BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; array[exports.BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; array[exports.BLEND_MODES.NONE] = [0, 0]; - // not-premultiplied blend modes array[exports.BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; array[exports.BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE]; array[exports.BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA]; - // composite operations array[exports.BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO]; array[exports.BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO]; @@ -27348,10 +25058,8 @@ var PIXI = (function (exports) { array[exports.BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA]; array[exports.BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA]; array[exports.BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA]; - // SUBTRACT from flash array[exports.BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD]; - return array; } @@ -27360,7 +25068,6 @@ var PIXI = (function (exports) { var CULLING$1 = 2; var DEPTH_TEST$1 = 3; var WINDING$1 = 4; - /** * System plugin to the renderer to manage WebGL state machines. * @@ -27368,319 +25075,250 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var StateSystem = /*@__PURE__*/(function (System) { - function StateSystem(renderer) - { - System.call(this, renderer); - + var StateSystem = /** @class */ (function (_super) { + __extends$2(StateSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function StateSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * GL context * @member {WebGLRenderingContext} * @readonly */ - this.gl = null; - + _this.gl = null; /** * State ID * @member {number} * @readonly */ - this.stateId = 0; - + _this.stateId = 0; /** * Polygon offset * @member {number} * @readonly */ - this.polygonOffset = 0; - + _this.polygonOffset = 0; /** * Blend mode * @member {number} * @default PIXI.BLEND_MODES.NONE * @readonly */ - this.blendMode = exports.BLEND_MODES.NONE; - + _this.blendMode = exports.BLEND_MODES.NONE; /** * Whether current blend equation is different * @member {boolean} * @protected */ - this._blendEq = false; - + _this._blendEq = false; /** * Collection of calls * @member {function[]} * @readonly */ - this.map = []; - + _this.map = []; // map functions for when we set state.. - this.map[BLEND$1] = this.setBlend; - this.map[OFFSET$1] = this.setOffset; - this.map[CULLING$1] = this.setCullFace; - this.map[DEPTH_TEST$1] = this.setDepthTest; - this.map[WINDING$1] = this.setFrontFace; - + _this.map[BLEND$1] = _this.setBlend; + _this.map[OFFSET$1] = _this.setOffset; + _this.map[CULLING$1] = _this.setCullFace; + _this.map[DEPTH_TEST$1] = _this.setDepthTest; + _this.map[WINDING$1] = _this.setFrontFace; /** * Collection of check calls * @member {function[]} * @readonly */ - this.checks = []; - + _this.checks = []; /** * Default WebGL State * @member {PIXI.State} * @readonly */ - this.defaultState = new State(); - this.defaultState.blend = true; - this.defaultState.depth = true; + _this.defaultState = new State(); + _this.defaultState.blend = true; + return _this; } - - if ( System ) { StateSystem.__proto__ = System; } - StateSystem.prototype = Object.create( System && System.prototype ); - StateSystem.prototype.constructor = StateSystem; - - StateSystem.prototype.contextChange = function contextChange (gl) - { + StateSystem.prototype.contextChange = function (gl) { this.gl = gl; - this.blendModes = mapWebGLBlendModesToPixi(gl); - this.set(this.defaultState); - this.reset(); }; - /** * Sets the current state * * @param {*} state - The state to set. */ - StateSystem.prototype.set = function set (state) - { + StateSystem.prototype.set = function (state) { state = state || this.defaultState; - // TODO maybe to an object check? ( this.state === state )? - if (this.stateId !== state.data) - { + if (this.stateId !== state.data) { var diff = this.stateId ^ state.data; var i = 0; - // order from least to most common - while (diff) - { - if (diff & 1) - { + while (diff) { + if (diff & 1) { // state change! this.map[i].call(this, !!(state.data & (1 << i))); } - diff = diff >> 1; i++; } - this.stateId = state.data; } - // based on the above settings we check for specific modes.. // for example if blend is active we check and set the blend modes // or of polygon offset is active we check the poly depth. - for (var i$1 = 0; i$1 < this.checks.length; i$1++) - { - this.checks[i$1](this, state); + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); } }; - /** * Sets the state, when previous state is unknown * * @param {*} state - The state to set */ - StateSystem.prototype.forceState = function forceState (state) - { + StateSystem.prototype.forceState = function (state) { state = state || this.defaultState; - for (var i = 0; i < this.map.length; i++) - { + for (var i = 0; i < this.map.length; i++) { this.map[i].call(this, !!(state.data & (1 << i))); } - for (var i$1 = 0; i$1 < this.checks.length; i$1++) - { - this.checks[i$1](this, state); + for (var i = 0; i < this.checks.length; i++) { + this.checks[i](this, state); } - this.stateId = state.data; }; - /** * Enables or disabled blending. * * @param {boolean} value - Turn on or off webgl blending. */ - StateSystem.prototype.setBlend = function setBlend (value) - { + StateSystem.prototype.setBlend = function (value) { this.updateCheck(StateSystem.checkBlendMode, value); - this.gl[value ? 'enable' : 'disable'](this.gl.BLEND); }; - /** * Enables or disable polygon offset fill * * @param {boolean} value - Turn on or off webgl polygon offset testing. */ - StateSystem.prototype.setOffset = function setOffset (value) - { + StateSystem.prototype.setOffset = function (value) { this.updateCheck(StateSystem.checkPolygonOffset, value); - this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL); }; - /** * Sets whether to enable or disable depth test. * * @param {boolean} value - Turn on or off webgl depth testing. */ - StateSystem.prototype.setDepthTest = function setDepthTest (value) - { + StateSystem.prototype.setDepthTest = function (value) { this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST); }; - /** * Sets whether to enable or disable cull face. * * @param {boolean} value - Turn on or off webgl cull face. */ - StateSystem.prototype.setCullFace = function setCullFace (value) - { + StateSystem.prototype.setCullFace = function (value) { this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE); }; - /** * Sets the gl front face. * * @param {boolean} value - true is clockwise and false is counter-clockwise */ - StateSystem.prototype.setFrontFace = function setFrontFace (value) - { + StateSystem.prototype.setFrontFace = function (value) { this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']); }; - /** * Sets the blend mode. * * @param {number} value - The blend mode to set to. */ - StateSystem.prototype.setBlendMode = function setBlendMode (value) - { - if (value === this.blendMode) - { + StateSystem.prototype.setBlendMode = function (value) { + if (value === this.blendMode) { return; } - this.blendMode = value; - var mode = this.blendModes[value]; var gl = this.gl; - - if (mode.length === 2) - { + if (mode.length === 2) { gl.blendFunc(mode[0], mode[1]); } - else - { + else { gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]); } - if (mode.length === 6) - { + if (mode.length === 6) { this._blendEq = true; gl.blendEquationSeparate(mode[4], mode[5]); } - else if (this._blendEq) - { + else if (this._blendEq) { this._blendEq = false; gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD); } }; - /** * Sets the polygon offset. * * @param {number} value - the polygon offset * @param {number} scale - the polygon offset scale */ - StateSystem.prototype.setPolygonOffset = function setPolygonOffset (value, scale) - { + StateSystem.prototype.setPolygonOffset = function (value, scale) { this.gl.polygonOffset(value, scale); }; - // used /** * Resets all the logic and disables the vaos */ - StateSystem.prototype.reset = function reset () - { + StateSystem.prototype.reset = function () { this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false); - - this.forceState(0); - + this.forceState(this.defaultState); this._blendEq = true; this.blendMode = -1; this.setBlendMode(0); }; - /** * checks to see which updates should be checked based on which settings have been activated. * For example, if blend is enabled then we should check the blend modes each time the state is changed * or if polygon fill is activated then we need to check if the polygon offset changes. * The idea is that we only check what we have too. * - * @param {Function} func the checking function to add or remove - * @param {boolean} value should the check function be added or removed. + * @param {Function} func - the checking function to add or remove + * @param {boolean} value - should the check function be added or removed. */ - StateSystem.prototype.updateCheck = function updateCheck (func, value) - { + StateSystem.prototype.updateCheck = function (func, value) { var index = this.checks.indexOf(func); - - if (value && index === -1) - { + if (value && index === -1) { this.checks.push(func); } - else if (!value && index !== -1) - { + else if (!value && index !== -1) { this.checks.splice(index, 1); } }; - /** * A private little wrapper function that we call to check the blend mode. * * @static * @private - * @param {PIXI.StateSystem} System the System to perform the state check on - * @param {PIXI.State} state the state that the blendMode will pulled from + * @param {PIXI.StateSystem} System - the System to perform the state check on + * @param {PIXI.State} state - the state that the blendMode will pulled from */ - StateSystem.checkBlendMode = function checkBlendMode (system, state) - { + StateSystem.checkBlendMode = function (system, state) { system.setBlendMode(state.blendMode); }; - /** * A private little wrapper function that we call to check the polygon offset. * * @static * @private - * @param {PIXI.StateSystem} System the System to perform the state check on - * @param {PIXI.State} state the state that the blendMode will pulled from + * @param {PIXI.StateSystem} System - the System to perform the state check on + * @param {PIXI.State} state - the state that the blendMode will pulled from */ - StateSystem.checkPolygonOffset = function checkPolygonOffset (system, state) - { - system.setPolygonOffset(state.polygonOffset, 0); + StateSystem.checkPolygonOffset = function (system, state) { + system.setPolygonOffset(1, state.polygonOffset); }; - return StateSystem; }(System)); @@ -27692,139 +25330,106 @@ var PIXI = (function (exports) { * @memberof PIXI.systems * @extends PIXI.System */ - var TextureGCSystem = /*@__PURE__*/(function (System) { - function TextureGCSystem(renderer) - { - System.call(this, renderer); - + var TextureGCSystem = /** @class */ (function (_super) { + __extends$2(TextureGCSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function TextureGCSystem(renderer) { + var _this = _super.call(this, renderer) || this; /** * Count * @member {number} * @readonly */ - this.count = 0; - + _this.count = 0; /** * Check count * @member {number} * @readonly */ - this.checkCount = 0; - + _this.checkCount = 0; /** * Maximum idle time, in seconds * @member {number} * @see PIXI.settings.GC_MAX_IDLE */ - this.maxIdle = settings.GC_MAX_IDLE; - + _this.maxIdle = settings.GC_MAX_IDLE; /** * Maximum number of item to check * @member {number} * @see PIXI.settings.GC_MAX_CHECK_COUNT */ - this.checkCountMax = settings.GC_MAX_CHECK_COUNT; - + _this.checkCountMax = settings.GC_MAX_CHECK_COUNT; /** * Current garabage collection mode * @member {PIXI.GC_MODES} * @see PIXI.settings.GC_MODE */ - this.mode = settings.GC_MODE; + _this.mode = settings.GC_MODE; + return _this; } - - if ( System ) { TextureGCSystem.__proto__ = System; } - TextureGCSystem.prototype = Object.create( System && System.prototype ); - TextureGCSystem.prototype.constructor = TextureGCSystem; - /** * Checks to see when the last time a texture was used * if the texture has not been used for a specified amount of time it will be removed from the GPU */ - TextureGCSystem.prototype.postrender = function postrender () - { - if (!this.renderer.renderingToScreen) - { + TextureGCSystem.prototype.postrender = function () { + if (!this.renderer.renderingToScreen) { return; } - this.count++; - - if (this.mode === exports.GC_MODES.MANUAL) - { + if (this.mode === exports.GC_MODES.MANUAL) { return; } - this.checkCount++; - - if (this.checkCount > this.checkCountMax) - { + if (this.checkCount > this.checkCountMax) { this.checkCount = 0; - this.run(); } }; - /** * Checks to see when the last time a texture was used * if the texture has not been used for a specified amount of time it will be removed from the GPU */ - TextureGCSystem.prototype.run = function run () - { + TextureGCSystem.prototype.run = function () { var tm = this.renderer.texture; - var managedTextures = tm.managedTextures; + var managedTextures = tm.managedTextures; var wasRemoved = false; - - for (var i = 0; i < managedTextures.length; i++) - { + for (var i = 0; i < managedTextures.length; i++) { var texture = managedTextures[i]; - // only supports non generated textures at the moment! - if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) - { + if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) { tm.destroyTexture(texture, true); managedTextures[i] = null; wasRemoved = true; } } - - if (wasRemoved) - { + if (wasRemoved) { var j = 0; - - for (var i$1 = 0; i$1 < managedTextures.length; i$1++) - { - if (managedTextures[i$1] !== null) - { - managedTextures[j++] = managedTextures[i$1]; + for (var i = 0; i < managedTextures.length; i++) { + if (managedTextures[i] !== null) { + managedTextures[j++] = managedTextures[i]; } } - managedTextures.length = j; } }; - /** * Removes all the textures within the specified displayObject and its children from the GPU * * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from. */ - TextureGCSystem.prototype.unload = function unload (displayObject) - { - var tm = this.renderer.textureSystem; - + TextureGCSystem.prototype.unload = function (displayObject) { + var _a; + var tm = this.renderer.texture; // only destroy non generated textures - if (displayObject._texture && displayObject._texture._glRenderTargets) - { + if ((_a = displayObject._texture) === null || _a === void 0 ? void 0 : _a.framebuffer) { tm.destroyTexture(displayObject._texture); } - - for (var i = displayObject.children.length - 1; i >= 0; i--) - { + for (var i = displayObject.children.length - 1; i >= 0; i--) { this.unload(displayObject.children[i]); } }; - return TextureGCSystem; }(System)); @@ -27833,62 +25438,56 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var GLTexture = function GLTexture(texture) - { - /** - * The WebGL texture - * @member {WebGLTexture} - */ - this.texture = texture; - - /** - * Width of texture that was used in texImage2D - * @member {number} - */ - this.width = -1; - - /** - * Height of texture that was used in texImage2D - * @member {number} - */ - this.height = -1; - - /** - * Texture contents dirty flag - * @member {number} - */ - this.dirtyId = -1; - - /** - * Texture style dirty flag - * @member {number} - */ - this.dirtyStyleId = -1; - - /** - * Whether mip levels has to be generated - * @member {boolean} - */ - this.mipmap = false; - - /** - * WrapMode copied from baseTexture - * @member {number} - */ - this.wrapMode = 33071; - - /** - * Type copied from baseTexture - * @member {number} - */ - this.type = 6408; - - /** - * Type copied from baseTexture - * @member {number} - */ - this.internalFormat = 5121; - }; + var GLTexture = /** @class */ (function () { + function GLTexture(texture) { + /** + * The WebGL texture + * @member {WebGLTexture} + */ + this.texture = texture; + /** + * Width of texture that was used in texImage2D + * @member {number} + */ + this.width = -1; + /** + * Height of texture that was used in texImage2D + * @member {number} + */ + this.height = -1; + /** + * Texture contents dirty flag + * @member {number} + */ + this.dirtyId = -1; + /** + * Texture style dirty flag + * @member {number} + */ + this.dirtyStyleId = -1; + /** + * Whether mip levels has to be generated + * @member {boolean} + */ + this.mipmap = false; + /** + * WrapMode copied from baseTexture + * @member {number} + */ + this.wrapMode = 33071; + /** + * Type copied from baseTexture + * @member {number} + */ + this.type = 6408; + /** + * Type copied from baseTexture + * @member {number} + */ + this.internalFormat = 5121; + } + return GLTexture; + }()); /** * System plugin to the renderer to manage textures. @@ -27897,396 +25496,282 @@ var PIXI = (function (exports) { * @extends PIXI.System * @memberof PIXI.systems */ - var TextureSystem = /*@__PURE__*/(function (System) { - function TextureSystem(renderer) - { - System.call(this, renderer); - + var TextureSystem = /** @class */ (function (_super) { + __extends$2(TextureSystem, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this System works for. + */ + function TextureSystem(renderer) { + var _this = _super.call(this, renderer) || this; // TODO set to max textures... /** * Bound textures * @member {PIXI.BaseTexture[]} * @readonly */ - this.boundTextures = []; + _this.boundTextures = []; /** * Current location * @member {number} * @readonly */ - this.currentLocation = -1; - + _this.currentLocation = -1; /** * List of managed textures * @member {PIXI.BaseTexture[]} * @readonly */ - this.managedTextures = []; - + _this.managedTextures = []; /** * Did someone temper with textures state? We'll overwrite them when we need to unbind something. * @member {boolean} * @private */ - this._unknownBoundTextures = false; - + _this._unknownBoundTextures = false; /** * BaseTexture value that shows that we don't know what is bound * @member {PIXI.BaseTexture} * @readonly */ - this.unknownTexture = new BaseTexture(); + _this.unknownTexture = new BaseTexture(); + return _this; } - - if ( System ) { TextureSystem.__proto__ = System; } - TextureSystem.prototype = Object.create( System && System.prototype ); - TextureSystem.prototype.constructor = TextureSystem; - /** * Sets up the renderer context and necessary buffers. */ - TextureSystem.prototype.contextChange = function contextChange () - { + TextureSystem.prototype.contextChange = function () { var gl = this.gl = this.renderer.gl; - this.CONTEXT_UID = this.renderer.CONTEXT_UID; - this.webGLVersion = this.renderer.context.webGLVersion; - var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); - this.boundTextures.length = maxTextures; - - for (var i = 0; i < maxTextures; i++) - { + for (var i = 0; i < maxTextures; i++) { this.boundTextures[i] = null; } - // TODO move this.. to a nice make empty textures class.. this.emptyTextures = {}; - var emptyTexture2D = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)); - this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D; this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture()); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture); - - for (var i$1 = 0; i$1 < 6; i$1++) - { - gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i$1, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); + for (var i = 0; i < 6; i++) { + gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); } - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - - for (var i$2 = 0; i$2 < this.boundTextures.length; i$2++) - { - this.bind(null, i$2); + for (var i = 0; i < this.boundTextures.length; i++) { + this.bind(null, i); } }; - /** * Bind a texture to a specific location * * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)` * - * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind + * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind * @param {number} [location=0] - Location to bind at */ - TextureSystem.prototype.bind = function bind (texture, location) - { - if ( location === void 0 ) { location = 0; } - - var ref = this; - var gl = ref.gl; - - if (texture) - { - texture = texture.baseTexture || texture; - - if (texture.valid) - { + TextureSystem.prototype.bind = function (texture, location) { + if (location === void 0) { location = 0; } + var gl = this.gl; + if (texture) { + texture = texture.castToBaseTexture(); + if (texture.parentTextureArray) { + // cannot bind partial texture + // TODO: report a warning + return; + } + if (texture.valid) { texture.touched = this.renderer.textureGC.count; - var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture); - - if (this.boundTextures[location] !== texture) - { - if (this.currentLocation !== location) - { + if (this.boundTextures[location] !== texture) { + if (this.currentLocation !== location) { this.currentLocation = location; gl.activeTexture(gl.TEXTURE0 + location); } gl.bindTexture(texture.target, glTexture.texture); } - - if (glTexture.dirtyId !== texture.dirtyId) - { - if (this.currentLocation !== location) - { + if (glTexture.dirtyId !== texture.dirtyId) { + if (this.currentLocation !== location) { this.currentLocation = location; gl.activeTexture(gl.TEXTURE0 + location); } this.updateTexture(texture); } - this.boundTextures[location] = texture; } } - else - { - if (this.currentLocation !== location) - { + else { + if (this.currentLocation !== location) { this.currentLocation = location; gl.activeTexture(gl.TEXTURE0 + location); } - gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture); this.boundTextures[location] = null; } }; - /** * Resets texture location and bound textures * * Actual `bind(null, i)` calls will be performed at next `unbind()` call */ - TextureSystem.prototype.reset = function reset () - { + TextureSystem.prototype.reset = function () { this._unknownBoundTextures = true; this.currentLocation = -1; - - for (var i = 0; i < this.boundTextures.length; i++) - { + for (var i = 0; i < this.boundTextures.length; i++) { this.boundTextures[i] = this.unknownTexture; } }; - /** * Unbind a texture - * @param {PIXI.Texture|PIXI.BaseTexture} texture - Texture to bind + * @param {PIXI.BaseTexture} texture - Texture to bind */ - TextureSystem.prototype.unbind = function unbind (texture) - { - var ref = this; - var gl = ref.gl; - var boundTextures = ref.boundTextures; - - if (this._unknownBoundTextures) - { + TextureSystem.prototype.unbind = function (texture) { + var _a = this, gl = _a.gl, boundTextures = _a.boundTextures; + if (this._unknownBoundTextures) { this._unknownBoundTextures = false; // someone changed webGL state, // we have to be sure that our texture does not appear in multi-texture renderer samplers - for (var i = 0; i < boundTextures.length; i++) - { - if (boundTextures[i] === this.unknownTexture) - { + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === this.unknownTexture) { this.bind(null, i); } } } - - for (var i$1 = 0; i$1 < boundTextures.length; i$1++) - { - if (boundTextures[i$1] === texture) - { - if (this.currentLocation !== i$1) - { - gl.activeTexture(gl.TEXTURE0 + i$1); - this.currentLocation = i$1; + for (var i = 0; i < boundTextures.length; i++) { + if (boundTextures[i] === texture) { + if (this.currentLocation !== i) { + gl.activeTexture(gl.TEXTURE0 + i); + this.currentLocation = i; } - gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[texture.target].texture); - boundTextures[i$1] = null; + boundTextures[i] = null; } } }; - /** * Initialize a texture * * @private * @param {PIXI.BaseTexture} texture - Texture to initialize */ - TextureSystem.prototype.initTexture = function initTexture (texture) - { + TextureSystem.prototype.initTexture = function (texture) { var glTexture = new GLTexture(this.gl.createTexture()); - // guarantee an update.. glTexture.dirtyId = -1; - texture._glTextures[this.CONTEXT_UID] = glTexture; - this.managedTextures.push(texture); texture.on('dispose', this.destroyTexture, this); - return glTexture; }; - - TextureSystem.prototype.initTextureType = function initTextureType (texture, glTexture) - { + TextureSystem.prototype.initTextureType = function (texture, glTexture) { glTexture.internalFormat = texture.format; glTexture.type = texture.type; - if (this.webGLVersion !== 2) - { + if (this.webGLVersion !== 2) { return; } var gl = this.renderer.gl; - if (texture.type === gl.FLOAT - && texture.format === gl.RGBA) - { + && texture.format === gl.RGBA) { glTexture.internalFormat = gl.RGBA32F; } // that's WebGL1 HALF_FLOAT_OES // we have to convert it to WebGL HALF_FLOAT - if (texture.type === exports.TYPES.HALF_FLOAT) - { + if (texture.type === exports.TYPES.HALF_FLOAT) { glTexture.type = gl.HALF_FLOAT; } if (glTexture.type === gl.HALF_FLOAT - && texture.format === gl.RGBA) - { + && texture.format === gl.RGBA) { glTexture.internalFormat = gl.RGBA16F; } }; - /** * Update a texture * * @private * @param {PIXI.BaseTexture} texture - Texture to initialize */ - TextureSystem.prototype.updateTexture = function updateTexture (texture) - { + TextureSystem.prototype.updateTexture = function (texture) { var glTexture = texture._glTextures[this.CONTEXT_UID]; - - if (!glTexture) - { + if (!glTexture) { return; } - var renderer = this.renderer; - this.initTextureType(texture, glTexture); - - if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) - { ; } - else - { + if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) { ; } + else { // default, renderTexture-like logic var width = texture.realWidth; var height = texture.realHeight; var gl = renderer.gl; - if (glTexture.width !== width || glTexture.height !== height - || glTexture.dirtyId < 0) - { + || glTexture.dirtyId < 0) { glTexture.width = width; glTexture.height = height; - - gl.texImage2D(texture.target, 0, - glTexture.internalFormat, - width, - height, - 0, - texture.format, - glTexture.type, - null); + gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null); } } - // lets only update what changes.. - if (texture.dirtyStyleId !== glTexture.dirtyStyleId) - { + if (texture.dirtyStyleId !== glTexture.dirtyStyleId) { this.updateTextureStyle(texture); } glTexture.dirtyId = texture.dirtyId; }; - /** * Deletes the texture from WebGL * * @private - * @param {PIXI.BaseTexture|PIXI.Texture} texture - the texture to destroy + * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager. */ - TextureSystem.prototype.destroyTexture = function destroyTexture (texture, skipRemove) - { - var ref = this; - var gl = ref.gl; - - texture = texture.baseTexture || texture; - - if (texture._glTextures[this.CONTEXT_UID]) - { + TextureSystem.prototype.destroyTexture = function (texture, skipRemove) { + var gl = this.gl; + texture = texture.castToBaseTexture(); + if (texture._glTextures[this.CONTEXT_UID]) { this.unbind(texture); - gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture); texture.off('dispose', this.destroyTexture, this); - delete texture._glTextures[this.CONTEXT_UID]; - - if (!skipRemove) - { + if (!skipRemove) { var i = this.managedTextures.indexOf(texture); - - if (i !== -1) - { + if (i !== -1) { removeItems(this.managedTextures, i, 1); } } } }; - /** * Update texture style such as mipmap flag * * @private * @param {PIXI.BaseTexture} texture - Texture to update */ - TextureSystem.prototype.updateTextureStyle = function updateTextureStyle (texture) - { + TextureSystem.prototype.updateTextureStyle = function (texture) { var glTexture = texture._glTextures[this.CONTEXT_UID]; - - if (!glTexture) - { + if (!glTexture) { return; } - - if ((texture.mipmap === exports.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) - { - glTexture.mipmap = 0; + if ((texture.mipmap === exports.MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) { + glTexture.mipmap = false; } - else - { + else { glTexture.mipmap = texture.mipmap >= 1; } - - if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) - { + if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) { glTexture.wrapMode = exports.WRAP_MODES.CLAMP; } - else - { + else { glTexture.wrapMode = texture.wrapMode; } - - if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) - { ; } - else - { + if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) { ; } + else { this.setStyle(texture, glTexture); } - glTexture.dirtyStyleId = texture.dirtyStyleId; }; - /** * Set style for texture * @@ -28294,41 +25779,28 @@ var PIXI = (function (exports) { * @param {PIXI.BaseTexture} texture - Texture to update * @param {PIXI.GLTexture} glTexture */ - TextureSystem.prototype.setStyle = function setStyle (texture, glTexture) - { + TextureSystem.prototype.setStyle = function (texture, glTexture) { var gl = this.gl; - - if (glTexture.mipmap) - { + if (glTexture.mipmap) { gl.generateMipmap(texture.target); } - gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode); gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode); - - if (glTexture.mipmap) - { + if (glTexture.mipmap) { /* eslint-disable max-len */ - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); /* eslint-disable max-len */ - var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering; - - if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === exports.SCALE_MODES.LINEAR) - { + if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === exports.SCALE_MODES.LINEAR) { var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT)); - gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level); } } - else - { - gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST); + else { + gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); } - - gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode ? gl.LINEAR : gl.NEAREST); + gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === exports.SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST); }; - return TextureSystem; }(System)); @@ -28355,7 +25827,6 @@ var PIXI = (function (exports) { }); var tempMatrix = new Matrix(); - /** * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer} * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene. @@ -28365,29 +25836,44 @@ var PIXI = (function (exports) { * @extends PIXI.utils.EventEmitter * @memberof PIXI */ - var AbstractRenderer = /*@__PURE__*/(function (EventEmitter) { - function AbstractRenderer(system, options) - { - EventEmitter.call(this); - + var AbstractRenderer = /** @class */ (function (_super) { + __extends$2(AbstractRenderer, _super); + /** + * @param {string} system - The name of the system this renderer is for. + * @param {object} [options] - The optional renderer parameters. + * @param {number} [options.width=800] - The width of the screen. + * @param {number} [options.height=600] - The height of the screen. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. The + * resolution of the renderer retina would be 2. + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the WebGL context. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + */ + function AbstractRenderer(type, options) { + if (type === void 0) { type = exports.RENDERER_TYPE.UNKNOWN; } + var _this = _super.call(this) || this; // Add the default render options options = Object.assign({}, settings.RENDER_OPTIONS, options); - // Deprecation notice for renderer roundPixels option - if (options.roundPixels) - { + if (options.roundPixels) { settings.ROUND_PIXELS = options.roundPixels; deprecation('5.0.0', 'Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS', 2); } - /** * The supplied constructor options. * * @member {Object} * @readOnly */ - this.options = options; - + _this.options = options; /** * The type of the renderer. * @@ -28395,8 +25881,7 @@ var PIXI = (function (exports) { * @default PIXI.RENDERER_TYPE.UNKNOWN * @see PIXI.RENDERER_TYPE */ - this.type = exports.RENDERER_TYPE.UNKNOWN; - + _this.type = type; /** * Measurements of the screen. (0, 0, screenWidth, screenHeight). * @@ -28404,46 +25889,40 @@ var PIXI = (function (exports) { * * @member {PIXI.Rectangle} */ - this.screen = new Rectangle(0, 0, options.width, options.height); - + _this.screen = new Rectangle(0, 0, options.width, options.height); /** * The canvas element that everything is drawn to. * * @member {HTMLCanvasElement} */ - this.view = options.view || document.createElement('canvas'); - + _this.view = options.view || document.createElement('canvas'); /** * The resolution / device pixel ratio of the renderer. * * @member {number} * @default 1 */ - this.resolution = options.resolution || settings.RESOLUTION; - + _this.resolution = options.resolution || settings.RESOLUTION; /** * Whether the render view is transparent. * * @member {boolean} */ - this.transparent = options.transparent; - + _this.transparent = options.transparent; /** * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically. * * @member {boolean} */ - this.autoDensity = options.autoDensity || options.autoResize || false; + _this.autoDensity = options.autoDensity || options.autoResize || false; // autoResize is deprecated, provides fallback support - /** * The value of the preserveDrawingBuffer flag affects whether or not the contents of * the stencil buffer is retained after rendering. * * @member {boolean} */ - this.preserveDrawingBuffer = options.preserveDrawingBuffer; - + _this.preserveDrawingBuffer = options.preserveDrawingBuffer; /** * This sets if the CanvasRenderer will clear the canvas or not before the new render pass. * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every @@ -28454,102 +25933,83 @@ var PIXI = (function (exports) { * @member {boolean} * @default */ - this.clearBeforeRender = options.clearBeforeRender; - + _this.clearBeforeRender = options.clearBeforeRender; /** * The background color as a number. * * @member {number} * @protected */ - this._backgroundColor = 0x000000; - + _this._backgroundColor = 0x000000; /** * The background color as an [R, G, B] array. * * @member {number[]} * @protected */ - this._backgroundColorRgba = [0, 0, 0, 0]; - + _this._backgroundColorRgba = [0, 0, 0, 0]; /** * The background color as a string. * * @member {string} * @protected */ - this._backgroundColorString = '#000000'; - - this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter - - /** - * This temporary display object used as the parent of the currently being rendered item. - * - * @member {PIXI.DisplayObject} - * @protected - */ - this._tempDisplayObjectParent = new Container(); - + _this._backgroundColorString = '#000000'; + _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter /** * The last root object that the renderer tried to render. * * @member {PIXI.DisplayObject} * @protected */ - this._lastObjectRendered = this._tempDisplayObjectParent; - + _this._lastObjectRendered = null; /** * Collection of plugins. * @readonly * @member {object} */ - this.plugins = {}; + _this.plugins = {}; + return _this; } - - if ( EventEmitter ) { AbstractRenderer.__proto__ = EventEmitter; } - AbstractRenderer.prototype = Object.create( EventEmitter && EventEmitter.prototype ); - AbstractRenderer.prototype.constructor = AbstractRenderer; - - var prototypeAccessors = { width: { configurable: true },height: { configurable: true },backgroundColor: { configurable: true } }; - /** * Initialize the plugins. * * @protected * @param {object} staticMap - The dictionary of statically saved plugins. */ - AbstractRenderer.prototype.initPlugins = function initPlugins (staticMap) - { - for (var o in staticMap) - { + AbstractRenderer.prototype.initPlugins = function (staticMap) { + for (var o in staticMap) { this.plugins[o] = new (staticMap[o])(this); } }; - - /** - * Same as view.width, actual number of pixels in the canvas by horizontal. - * - * @member {number} - * @readonly - * @default 800 - */ - prototypeAccessors.width.get = function () - { - return this.view.width; - }; - - /** - * Same as view.height, actual number of pixels in the canvas by vertical. - * - * @member {number} - * @readonly - * @default 600 - */ - prototypeAccessors.height.get = function () - { - return this.view.height; - }; - + Object.defineProperty(AbstractRenderer.prototype, "width", { + /** + * Same as view.width, actual number of pixels in the canvas by horizontal. + * + * @member {number} + * @readonly + * @default 800 + */ + get: function () { + return this.view.width; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AbstractRenderer.prototype, "height", { + /** + * Same as view.height, actual number of pixels in the canvas by vertical. + * + * @member {number} + * @readonly + * @default 600 + */ + get: function () { + return this.view.height; + }, + enumerable: false, + configurable: true + }); /** * Resizes the screen and canvas to the specified width and height. * Canvas dimensions are multiplied by resolution. @@ -28557,116 +26017,95 @@ var PIXI = (function (exports) { * @param {number} screenWidth - The new width of the screen. * @param {number} screenHeight - The new height of the screen. */ - AbstractRenderer.prototype.resize = function resize (screenWidth, screenHeight) - { + AbstractRenderer.prototype.resize = function (screenWidth, screenHeight) { this.screen.width = screenWidth; this.screen.height = screenHeight; - this.view.width = screenWidth * this.resolution; this.view.height = screenHeight * this.resolution; - - if (this.autoDensity) - { + if (this.autoDensity) { this.view.style.width = screenWidth + "px"; this.view.style.height = screenHeight + "px"; } + /** + * Fired after view has been resized. + * + * @event PIXI.Renderer#resize + * @param {number} screenWidth - The new width of the screen. + * @param {number} screenHeight - The new height of the screen. + */ + this.emit('resize', screenWidth, screenHeight); }; - /** * Useful function that returns a texture of the display object that can then be used to create sprites * This can be quite useful if your displayObject is complicated and needs to be reused multiple times. * * @param {PIXI.DisplayObject} displayObject - The displayObject the object will be generated from. - * @param {number} scaleMode - Should be one of the scaleMode consts. + * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture. * @param {number} resolution - The resolution / device pixel ratio of the texture being generated. * @param {PIXI.Rectangle} [region] - The region of the displayObject, that shall be rendered, * if no region is specified, defaults to the local bounds of the displayObject. * @return {PIXI.RenderTexture} A texture of the graphics object. */ - AbstractRenderer.prototype.generateTexture = function generateTexture (displayObject, scaleMode, resolution, region) - { - region = region || displayObject.getLocalBounds(); - + AbstractRenderer.prototype.generateTexture = function (displayObject, scaleMode, resolution, region) { + region = region || displayObject.getLocalBounds(null, true); // minimum texture size is 1x1, 0x0 will throw an error - if (region.width === 0) { region.width = 1; } - if (region.height === 0) { region.height = 1; } - - var renderTexture = RenderTexture.create(region.width | 0, region.height | 0, scaleMode, resolution); - + if (region.width === 0) + { region.width = 1; } + if (region.height === 0) + { region.height = 1; } + var renderTexture = RenderTexture.create({ + width: region.width | 0, + height: region.height | 0, + scaleMode: scaleMode, + resolution: resolution, + }); tempMatrix.tx = -region.x; tempMatrix.ty = -region.y; - this.render(displayObject, renderTexture, false, tempMatrix, !!displayObject.parent); - return renderTexture; }; - /** * Removes everything from the renderer and optionally removes the Canvas DOM element. * * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. */ - AbstractRenderer.prototype.destroy = function destroy (removeView) - { - for (var o in this.plugins) - { + AbstractRenderer.prototype.destroy = function (removeView) { + for (var o in this.plugins) { this.plugins[o].destroy(); this.plugins[o] = null; } - - if (removeView && this.view.parentNode) - { + if (removeView && this.view.parentNode) { this.view.parentNode.removeChild(this.view); } - - this.plugins = null; - - this.type = exports.RENDERER_TYPE.UNKNOWN; - - this.view = null; - - this.screen = null; - - this.resolution = 0; - - this.transparent = false; - - this.autoDensity = false; - - this.blendModes = null; - - this.options = null; - - this.preserveDrawingBuffer = false; - this.clearBeforeRender = false; - - this._backgroundColor = 0; + var thisAny = this; + // null-ing all objects, that's a tradition! + thisAny.plugins = null; + thisAny.type = exports.RENDERER_TYPE.UNKNOWN; + thisAny.view = null; + thisAny.screen = null; + thisAny._tempDisplayObjectParent = null; + thisAny.options = null; this._backgroundColorRgba = null; this._backgroundColorString = null; - - this._tempDisplayObjectParent = null; this._lastObjectRendered = null; }; - - /** - * The background color to fill if not transparent - * - * @member {number} - */ - prototypeAccessors.backgroundColor.get = function () - { - return this._backgroundColor; - }; - - prototypeAccessors.backgroundColor.set = function (value) // eslint-disable-line require-jsdoc - { - this._backgroundColor = value; - this._backgroundColorString = hex2string(value); - hex2rgb(value, this._backgroundColorRgba); - }; - - Object.defineProperties( AbstractRenderer.prototype, prototypeAccessors ); - + Object.defineProperty(AbstractRenderer.prototype, "backgroundColor", { + /** + * The background color to fill if not transparent + * + * @member {number} + */ + get: function () { + return this._backgroundColor; + }, + set: function (value) { + this._backgroundColor = value; + this._backgroundColorString = hex2string(value); + hex2rgb(value, this._backgroundColorRgba); + }, + enumerable: false, + configurable: true + }); return AbstractRenderer; }(eventemitter3)); @@ -28682,36 +26121,45 @@ var PIXI = (function (exports) { * @memberof PIXI * @extends PIXI.AbstractRenderer */ - var Renderer = /*@__PURE__*/(function (AbstractRenderer) { - function Renderer(options) - { - if ( options === void 0 ) { options = {}; } - - AbstractRenderer.call(this, 'WebGL', options); - + var Renderer = /** @class */ (function (_super) { + __extends$2(Renderer, _super); + /** + * @param {object} [options] - The optional renderer parameters. + * @param {number} [options.width=800] - The width of the screen. + * @param {number} [options.height=600] - The height of the screen. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA + * antialiasing is used. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer. + * The resolution of the renderer retina would be 2. + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear + * the canvas or not before the new render pass. If you wish to set this to false, you *must* set + * preserveDrawingBuffer to `true`. + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, + * enable this if you need to call toDataUrl on the WebGL context. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to "high-performance" + * for devices with dual graphics card. + * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it. + * @public + */ + function Renderer(options) { + var _this = _super.call(this, exports.RENDERER_TYPE.WEBGL, options) || this; // the options will have been modified here in the super constructor with pixi's default settings.. - options = this.options; - - /** - * The type of this renderer as a standardized const - * - * @member {number} - * @see PIXI.RENDERER_TYPE - */ - this.type = exports.RENDERER_TYPE.WEBGL; - + options = _this.options; /** * WebGL context, set by the contextSystem (this.context) * * @readonly * @member {WebGLRenderingContext} */ - this.gl = null; - - this.CONTEXT_UID = 0; - + _this.gl = null; + _this.CONTEXT_UID = 0; // TODO legacy! - /** * Internal signal instances of **runner**, these * are assigned to each system created. @@ -28728,31 +26176,29 @@ var PIXI = (function (exports) { * @property {PIXI.Runner} prerender - Pre-render runner * @property {PIXI.Runner} resize - Resize runner */ - this.runners = { + _this.runners = { destroy: new Runner('destroy'), - contextChange: new Runner('contextChange', 1), + contextChange: new Runner('contextChange'), reset: new Runner('reset'), update: new Runner('update'), postrender: new Runner('postrender'), prerender: new Runner('prerender'), - resize: new Runner('resize', 2), + resize: new Runner('resize'), }; - /** * Global uniforms * @member {PIXI.UniformGroup} */ - this.globalUniforms = new UniformGroup({ + _this.globalUniforms = new UniformGroup({ projectionMatrix: new Matrix(), }, true); - /** * Mask system instance * @member {PIXI.systems.MaskSystem} mask * @memberof PIXI.Renderer# * @readonly */ - this.addSystem(MaskSystem, 'mask') + _this.addSystem(MaskSystem, 'mask') /** * Context system instance * @member {PIXI.systems.ContextSystem} context @@ -28837,7 +26283,6 @@ var PIXI = (function (exports) { * @readonly */ .addSystem(RenderTextureSystem, 'renderTexture') - /** * Batch system instance * @member {PIXI.systems.BatchSystem} batch @@ -28845,45 +26290,47 @@ var PIXI = (function (exports) { * @readonly */ .addSystem(BatchSystem, 'batch'); - - this.initPlugins(Renderer.__plugins); - + _this.initPlugins(Renderer.__plugins); /** * The options passed in to create a new WebGL context. */ - if (options.context) - { - this.context.initFromContext(options.context); + if (options.context) { + _this.context.initFromContext(options.context); } - else - { - this.context.initFromOptions({ - alpha: this.transparent, + else { + _this.context.initFromOptions({ + alpha: !!_this.transparent, antialias: options.antialias, - premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied', + premultipliedAlpha: _this.transparent && _this.transparent !== 'notMultiplied', stencil: true, preserveDrawingBuffer: options.preserveDrawingBuffer, - powerPreference: this.options.powerPreference, + powerPreference: _this.options.powerPreference, }); } - /** * Flag if we are rendering to the screen vs renderTexture * @member {boolean} * @readonly * @default true */ - this.renderingToScreen = true; - - sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); - - this.resize(this.options.width, this.options.height); + _this.renderingToScreen = true; + sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1'); + _this.resize(_this.options.width, _this.options.height); + return _this; } - - if ( AbstractRenderer ) { Renderer.__proto__ = AbstractRenderer; } - Renderer.prototype = Object.create( AbstractRenderer && AbstractRenderer.prototype ); - Renderer.prototype.constructor = Renderer; - + /** + * Create renderer if WebGL is available. Overrideable + * by the **@pixi/canvas-renderer** package to allow fallback. + * throws error if WebGL is not available. + * @static + * @private + */ + Renderer.create = function (options) { + if (isWebGLSupported()) { + return new Renderer(options); + } + throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); + }; /** * Add a new system to the renderer. * @param {Function} ClassRef - Class reference @@ -28893,59 +26340,36 @@ var PIXI = (function (exports) { * sure it doesn't collide with properties on Renderer. * @return {PIXI.Renderer} Return instance of renderer */ - Renderer.create = function create (options) - { - if (isWebGLSupported()) - { - return new Renderer(options); - } - - throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.'); - }; - - Renderer.prototype.addSystem = function addSystem (ClassRef, name) - { - if (!name) - { + Renderer.prototype.addSystem = function (ClassRef, name) { + if (!name) { name = ClassRef.name; } - var system = new ClassRef(this); - - if (this[name]) - { - throw new Error(("Whoops! The name \"" + name + "\" is already in use")); + if (this[name]) { + throw new Error("Whoops! The name \"" + name + "\" is already in use"); } - this[name] = system; - - for (var i in this.runners) - { + for (var i in this.runners) { this.runners[i].add(system); } - /** * Fired after rendering finishes. * * @event PIXI.Renderer#postrender */ - /** * Fired before rendering starts. * * @event PIXI.Renderer#prerender */ - /** * Fired when the WebGL context is set. * * @event PIXI.Renderer#context * @param {WebGLRenderingContext} gl - WebGL context. */ - return this; }; - /** * Renders the object to its WebGL view * @@ -28955,134 +26379,85 @@ var PIXI = (function (exports) { * @param {PIXI.Matrix} [transform] - A transform to apply to the render texture before rendering. * @param {boolean} [skipUpdateTransform=false] - Should we skip the update transform pass? */ - Renderer.prototype.render = function render (displayObject, renderTexture, clear, transform, skipUpdateTransform) - { + Renderer.prototype.render = function (displayObject, renderTexture, clear, transform, skipUpdateTransform) { // can be handy to know! this.renderingToScreen = !renderTexture; - - this.runners.prerender.run(); + this.runners.prerender.emit(); this.emit('prerender'); - // apply a transform at a GPU level this.projection.transform = transform; - // no point rendering if our context has been blown up! - if (this.context.isLost) - { + if (this.context.isLost) { return; } - - if (!renderTexture) - { + if (!renderTexture) { this._lastObjectRendered = displayObject; } - - if (!skipUpdateTransform) - { + if (!skipUpdateTransform) { // update the scene graph - var cacheParent = displayObject.parent; - - displayObject.parent = this._tempDisplayObjectParent; + var cacheParent = displayObject.enableTempParent(); displayObject.updateTransform(); - displayObject.parent = cacheParent; + displayObject.disableTempParent(cacheParent); // displayObject.hitArea = //TODO add a temp hit area } - this.renderTexture.bind(renderTexture); this.batch.currentRenderer.start(); - - if (clear !== undefined ? clear : this.clearBeforeRender) - { + if (clear !== undefined ? clear : this.clearBeforeRender) { this.renderTexture.clear(); } - displayObject.render(this); - // apply transform.. this.batch.currentRenderer.flush(); - - if (renderTexture) - { + if (renderTexture) { renderTexture.baseTexture.update(); } - - this.runners.postrender.run(); - + this.runners.postrender.emit(); // reset transform after render this.projection.transform = null; - this.emit('postrender'); }; - /** * Resizes the WebGL view to the specified width and height. * * @param {number} screenWidth - The new width of the screen. * @param {number} screenHeight - The new height of the screen. */ - Renderer.prototype.resize = function resize (screenWidth, screenHeight) - { - AbstractRenderer.prototype.resize.call(this, screenWidth, screenHeight); - - this.runners.resize.run(screenWidth, screenHeight); + Renderer.prototype.resize = function (screenWidth, screenHeight) { + _super.prototype.resize.call(this, screenWidth, screenHeight); + this.runners.resize.emit(screenWidth, screenHeight); }; - /** * Resets the WebGL state so you can render things however you fancy! * * @return {PIXI.Renderer} Returns itself. */ - Renderer.prototype.reset = function reset () - { - this.runners.reset.run(); - + Renderer.prototype.reset = function () { + this.runners.reset.emit(); return this; }; - /** * Clear the frame buffer */ - Renderer.prototype.clear = function clear () - { - this.framebuffer.bind(); - this.framebuffer.clear(); + Renderer.prototype.clear = function () { + this.renderTexture.bind(); + this.renderTexture.clear(); }; - /** * Removes everything from the renderer (event listeners, spritebatch, etc...) * * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM. * See: https://github.com/pixijs/pixi.js/issues/2233 */ - Renderer.prototype.destroy = function destroy (removeView) - { - this.runners.destroy.run(); - - for (var r in this.runners) - { + Renderer.prototype.destroy = function (removeView) { + this.runners.destroy.emit(); + for (var r in this.runners) { this.runners[r].destroy(); } - // call base destroy - AbstractRenderer.prototype.destroy.call(this, removeView); - + _super.prototype.destroy.call(this, removeView); // TODO nullify all the managers.. this.gl = null; }; - - /** - * Collection of installed plugins. These are included by default in PIXI, but can be excluded - * by creating a custom build. Consult the README for more information about creating custom - * builds and excluding plugins. - * @name PIXI.Renderer#plugins - * @type {object} - * @readonly - * @property {PIXI.accessibility.AccessibilityManager} accessibility Support tabbing interactive elements. - * @property {PIXI.Extract} extract Extract image data from renderer. - * @property {PIXI.interaction.InteractionManager} interaction Handles mouse, touch and pointer events. - * @property {PIXI.Prepare} prepare Pre-render display objects. - */ - /** * Adds a plugin to the renderer. * @@ -29090,12 +26465,10 @@ var PIXI = (function (exports) { * @param {string} pluginName - The name of the plugin. * @param {Function} ctor - The constructor function or class for the plugin. */ - Renderer.registerPlugin = function registerPlugin (pluginName, ctor) - { + Renderer.registerPlugin = function (pluginName, ctor) { Renderer.__plugins = Renderer.__plugins || {}; Renderer.__plugins[pluginName] = ctor; }; - return Renderer; }(AbstractRenderer)); @@ -29124,14 +26497,11 @@ var PIXI = (function (exports) { * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise * it is ignored. - * @param {boolean} [options.forceFXAA=false] - forces FXAA antialiasing to be used over native. - * FXAA is faster, but may not always look as great **webgl only** * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" * for devices with dual graphics card **webgl only** * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer */ - function autoDetectRenderer(options) - { + function autoDetectRenderer(options) { return Renderer.create(options); } @@ -29139,30 +26509,6 @@ var PIXI = (function (exports) { var defaultFilter = "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"; - /** - * A Texture that depends on six other resources. - * - * @class - * @extends PIXI.BaseTexture - * @memberof PIXI - */ - var CubeTexture = /*@__PURE__*/(function (BaseTexture) { - function CubeTexture () { - BaseTexture.apply(this, arguments); - } - - if ( BaseTexture ) { CubeTexture.__proto__ = BaseTexture; } - CubeTexture.prototype = Object.create( BaseTexture && BaseTexture.prototype ); - CubeTexture.prototype.constructor = CubeTexture; - - CubeTexture.from = function from (resources, options) - { - return new CubeTexture(new CubeResource(resources, options)); - }; - - return CubeTexture; - }(BaseTexture)); - /** * Used by the batcher to draw batches. * Each one of these contains all information required to draw a bound geometry. @@ -29170,21 +26516,21 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var BatchDrawCall = function BatchDrawCall() - { - this.texArray = null; - this.blend = 0; - this.type = exports.DRAW_MODES.TRIANGLES; - - this.start = 0; - this.size = 0; - - /** - * data for uniforms or custom webgl state - * @member {object} - */ - this.data = null; - }; + var BatchDrawCall = /** @class */ (function () { + function BatchDrawCall() { + this.texArray = null; + this.blend = 0; + this.type = exports.DRAW_MODES.TRIANGLES; + this.start = 0; + this.size = 0; + /** + * data for uniforms or custom webgl state + * @member {object} + */ + this.data = null; + } + return BatchDrawCall; + }()); /** * Used by the batcher to build texture batches. @@ -29193,33 +26539,32 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var BatchTextureArray = function BatchTextureArray() - { - /** - * inside textures array - * @member {PIXI.BaseTexture[]} - */ - this.elements = []; - /** - * Respective locations for textures - * @member {number[]} - */ - this.ids = []; - /** - * number of filled elements - * @member {number} - */ - this.count = 0; - }; - - BatchTextureArray.prototype.clear = function clear () - { - for (var i = 0; i < this.count; i++) - { - this.elements[i] = null; + var BatchTextureArray = /** @class */ (function () { + function BatchTextureArray() { + /** + * inside textures array + * @member {PIXI.BaseTexture[]} + */ + this.elements = []; + /** + * Respective locations for textures + * @member {number[]} + */ + this.ids = []; + /** + * number of filled elements + * @member {number} + */ + this.count = 0; } - this.count = 0; - }; + BatchTextureArray.prototype.clear = function () { + for (var i = 0; i < this.count; i++) { + this.elements[i] = null; + } + this.count = 0; + }; + return BatchTextureArray; + }()); /** * Flexible wrapper around `ArrayBuffer` that also provides @@ -29228,156 +26573,148 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var ViewableBuffer = function ViewableBuffer(size) - { + var ViewableBuffer = /** @class */ (function () { /** - * Underlying `ArrayBuffer` that holds all the data - * and is of capacity `size`. - * - * @member {ArrayBuffer} + * @param {number} size - The size of the buffer in bytes. */ - this.rawBinaryData = new ArrayBuffer(size); - + function ViewableBuffer(size) { + /** + * Underlying `ArrayBuffer` that holds all the data + * and is of capacity `size`. + * + * @member {ArrayBuffer} + */ + this.rawBinaryData = new ArrayBuffer(size); + /** + * View on the raw binary data as a `Uint32Array`. + * + * @member {Uint32Array} + */ + this.uint32View = new Uint32Array(this.rawBinaryData); + /** + * View on the raw binary data as a `Float32Array`. + * + * @member {Float32Array} + */ + this.float32View = new Float32Array(this.rawBinaryData); + } + Object.defineProperty(ViewableBuffer.prototype, "int8View", { + /** + * View on the raw binary data as a `Int8Array`. + * + * @member {Int8Array} + */ + get: function () { + if (!this._int8View) { + this._int8View = new Int8Array(this.rawBinaryData); + } + return this._int8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint8View", { + /** + * View on the raw binary data as a `Uint8Array`. + * + * @member {Uint8Array} + */ + get: function () { + if (!this._uint8View) { + this._uint8View = new Uint8Array(this.rawBinaryData); + } + return this._uint8View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int16View", { + /** + * View on the raw binary data as a `Int16Array`. + * + * @member {Int16Array} + */ + get: function () { + if (!this._int16View) { + this._int16View = new Int16Array(this.rawBinaryData); + } + return this._int16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "uint16View", { + /** + * View on the raw binary data as a `Uint16Array`. + * + * @member {Uint16Array} + */ + get: function () { + if (!this._uint16View) { + this._uint16View = new Uint16Array(this.rawBinaryData); + } + return this._uint16View; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ViewableBuffer.prototype, "int32View", { + /** + * View on the raw binary data as a `Int32Array`. + * + * @member {Int32Array} + */ + get: function () { + if (!this._int32View) { + this._int32View = new Int32Array(this.rawBinaryData); + } + return this._int32View; + }, + enumerable: false, + configurable: true + }); /** - * View on the raw binary data as a `Uint32Array`. + * Returns the view of the given type. * - * @member {Uint32Array} + * @param {string} type - One of `int8`, `uint8`, `int16`, + * `uint16`, `int32`, `uint32`, and `float32`. + * @return {object} typed array of given type */ - this.uint32View = new Uint32Array(this.rawBinaryData); - + ViewableBuffer.prototype.view = function (type) { + return this[type + "View"]; + }; /** - * View on the raw binary data as a `Float32Array`. - * - * @member {Float32Array} + * Destroys all buffer references. Do not use after calling + * this. */ - this.float32View = new Float32Array(this.rawBinaryData); - }; - - var prototypeAccessors$5 = { int8View: { configurable: true },uint8View: { configurable: true },int16View: { configurable: true },uint16View: { configurable: true },int32View: { configurable: true } }; - - /** - * View on the raw binary data as a `Int8Array`. - * - * @member {Int8Array} - */ - prototypeAccessors$5.int8View.get = function () - { - if (!this._int8View) - { - this._int8View = new Int8Array(this.rawBinaryData); - } - - return this._int8View; - }; - - /** - * View on the raw binary data as a `Uint8Array`. - * - * @member {Uint8Array} - */ - prototypeAccessors$5.uint8View.get = function () - { - if (!this._uint8View) - { - this._uint8View = new Uint8Array(this.rawBinaryData); - } - - return this._uint8View; - }; - - /** - * View on the raw binary data as a `Int16Array`. - * - * @member {Int16Array} - */ - prototypeAccessors$5.int16View.get = function () - { - if (!this._int16View) - { - this._int16View = new Int16Array(this.rawBinaryData); - } - - return this._int16View; - }; - - /** - * View on the raw binary data as a `Uint16Array`. - * - * @member {Uint16Array} - */ - prototypeAccessors$5.uint16View.get = function () - { - if (!this._uint16View) - { - this._uint16View = new Uint16Array(this.rawBinaryData); - } - - return this._uint16View; - }; - - /** - * View on the raw binary data as a `Int32Array`. - * - * @member {Int32Array} - */ - prototypeAccessors$5.int32View.get = function () - { - if (!this._int32View) - { - this._int32View = new Int32Array(this.rawBinaryData); - } - - return this._int32View; - }; - - /** - * Returns the view of the given type. - * - * @param {string} type - One of `int8`, `uint8`, `int16`, - *`uint16`, `int32`, `uint32`, and `float32`. - * @return {object} typed array of given type - */ - ViewableBuffer.prototype.view = function view (type) - { - return this[(type + "View")]; - }; - - /** - * Destroys all buffer references. Do not use after calling - * this. - */ - ViewableBuffer.prototype.destroy = function destroy () - { - this.rawBinaryData = null; - this._int8View = null; - this._uint8View = null; - this._int16View = null; - this._uint16View = null; - this._int32View = null; - this.uint32View = null; - this.float32View = null; - }; - - ViewableBuffer.sizeOf = function sizeOf (type) - { - switch (type) - { - case 'int8': - case 'uint8': - return 1; - case 'int16': - case 'uint16': - return 2; - case 'int32': - case 'uint32': - case 'float32': - return 4; - default: - throw new Error((type + " isn't a valid view type")); - } - }; - - Object.defineProperties( ViewableBuffer.prototype, prototypeAccessors$5 ); + ViewableBuffer.prototype.destroy = function () { + this.rawBinaryData = null; + this._int8View = null; + this._uint8View = null; + this._int16View = null; + this._uint16View = null; + this._int32View = null; + this.uint32View = null; + this.float32View = null; + }; + ViewableBuffer.sizeOf = function (type) { + switch (type) { + case 'int8': + case 'uint8': + return 1; + case 'int16': + case 'uint16': + return 2; + case 'int32': + case 'uint32': + case 'float32': + return 4; + default: + throw new Error(type + " isn't a valid view type"); + } + }; + return ViewableBuffer; + }()); /** * Renderer dedicated to drawing and batching sprites. @@ -29392,11 +26729,16 @@ var PIXI = (function (exports) { * @memberof PIXI * @extends PIXI.ObjectRenderer */ - var AbstractBatchRenderer = /*@__PURE__*/(function (ObjectRenderer) { - function AbstractBatchRenderer(renderer) - { - ObjectRenderer.call(this, renderer); - + var AbstractBatchRenderer = /** @class */ (function (_super) { + __extends$2(AbstractBatchRenderer, _super); + /** + * This will hook onto the renderer's `contextChange` + * and `prerender` signals. + * + * @param {PIXI.Renderer} renderer - The renderer this works for. + */ + function AbstractBatchRenderer(renderer) { + var _this = _super.call(this, renderer) || this; /** * This is used to generate a shader that can * color each vertex based on a `aTextureId` @@ -29411,8 +26753,7 @@ var PIXI = (function (exports) { * @member {PIXI.BatchShaderGenerator} * @protected */ - this.shaderGenerator = null; - + _this.shaderGenerator = null; /** * The class that represents the geometry of objects * that are going to be batched with this. @@ -29421,8 +26762,7 @@ var PIXI = (function (exports) { * @default PIXI.BatchGeometry * @protected */ - this.geometryClass = null; - + _this.geometryClass = null; /** * Size of data being buffered per vertex in the * attribute buffers (in floats). By default, the @@ -29437,16 +26777,14 @@ var PIXI = (function (exports) { * @member {number} * @readonly */ - this.vertexSize = null; - + _this.vertexSize = null; /** * The WebGL state in which this renderer will work. * * @member {PIXI.State} * @readonly */ - this.state = State.for2d(); - + _this.state = State.for2d(); /** * The number of bufferable objects before a flush * occurs automatically. @@ -29454,8 +26792,7 @@ var PIXI = (function (exports) { * @member {number} * @default settings.SPRITE_BATCH_SIZE * 4 */ - this.size = settings.SPRITE_BATCH_SIZE * 4; - + _this.size = settings.SPRITE_BATCH_SIZE * 4; /** * Total count of all vertices used by the currently * buffered objects. @@ -29463,8 +26800,7 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._vertexCount = 0; - + _this._vertexCount = 0; /** * Total count of all indices used by the currently * buffered objects. @@ -29472,23 +26808,20 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._indexCount = 0; - + _this._indexCount = 0; /** * Buffer of objects that are yet to be rendered. * * @member {PIXI.DisplayObject[]} * @private */ - this._bufferedElements = []; - + _this._bufferedElements = []; /** - * Data for texture batch builder, helps to save a bit of CPU on a pass + * Data for texture batch builder, helps to save a bit of CPU on a pass. * @type {PIXI.BaseTexture[]} * @private */ - this._bufferedTextures = []; - + _this._bufferedTextures = []; /** * Number of elements that are buffered and are * waiting to be flushed. @@ -29496,8 +26829,7 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._bufferSize = 0; - + _this._bufferSize = 0; /** * This shader is generated by `this.shaderGenerator`. * @@ -29507,8 +26839,7 @@ var PIXI = (function (exports) { * @member {PIXI.Shader} * @protected */ - this._shader = null; - + _this._shader = null; /** * Pool of `this.geometryClass` geometry objects * that store buffers. They are used to pass data @@ -29522,8 +26853,7 @@ var PIXI = (function (exports) { * @private * @see PIXI.AbstractBatchRenderer.contextChange */ - this._packedGeometries = []; - + _this._packedGeometries = []; /** * Size of `this._packedGeometries`. It can be expanded * if more than `this._packedGeometryPoolSize` flushes @@ -29532,8 +26862,7 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._packedGeometryPoolSize = 2; - + _this._packedGeometryPoolSize = 2; /** * A flush may occur multiple times in a single * frame. On iOS devices or when @@ -29547,8 +26876,7 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._flushId = 0; - + _this._flushId = 0; /** * Pool of `ViewableBuffer` objects that are sorted in * order of increasing size. The flush method uses @@ -29562,8 +26890,7 @@ var PIXI = (function (exports) { * @private * @see PIXI.AbstractBatchRenderer#getAttributeBuffer */ - this._aBuffers = {}; - + _this._aBuffers = {}; /** * Pool of `Uint16Array` objects that are sorted in * order of increasing size. The flush method uses @@ -29577,8 +26904,7 @@ var PIXI = (function (exports) { * @private * @see PIXI.AbstractBatchRenderer#getIndexBuffer */ - this._iBuffers = {}; - + _this._iBuffers = {}; /** * Maximum number of textures that can be uploaded to * the GPU under the current context. It is initialized @@ -29588,99 +26914,71 @@ var PIXI = (function (exports) { * @see PIXI.AbstractBatchRenderer#contextChange * @readonly */ - this.MAX_TEXTURES = 1; - - this.renderer.on('prerender', this.onPrerender, this); - renderer.runners.contextChange.add(this); - - this._dcIndex = 0; - this._aIndex = 0; - this._iIndex = 0; - this._attributeBuffer = null; - this._indexBuffer = null; - this._tempBoundTextures = []; + _this.MAX_TEXTURES = 1; + _this.renderer.on('prerender', _this.onPrerender, _this); + renderer.runners.contextChange.add(_this); + _this._dcIndex = 0; + _this._aIndex = 0; + _this._iIndex = 0; + _this._attributeBuffer = null; + _this._indexBuffer = null; + _this._tempBoundTextures = []; + return _this; } - - if ( ObjectRenderer ) { AbstractBatchRenderer.__proto__ = ObjectRenderer; } - AbstractBatchRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype ); - AbstractBatchRenderer.prototype.constructor = AbstractBatchRenderer; - /** * Handles the `contextChange` signal. * * It calculates `this.MAX_TEXTURES` and allocating the * packed-geometry object pool. */ - AbstractBatchRenderer.prototype.contextChange = function contextChange () - { + AbstractBatchRenderer.prototype.contextChange = function () { var gl = this.renderer.gl; - - if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) - { + if (settings.PREFER_ENV === exports.ENV.WEBGL_LEGACY) { this.MAX_TEXTURES = 1; } - else - { + else { // step 1: first check max textures the GPU can handle. - this.MAX_TEXTURES = Math.min( - gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), - settings.SPRITE_MAX_TEXTURES); - + this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES); // step 2: check the maximum number of if statements the shader can have too.. - this.MAX_TEXTURES = checkMaxIfStatementsInShader( - this.MAX_TEXTURES, gl); + this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl); } - this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES); - // we use the second shader as the first one depending on your browser // may omit aTextureId as it is not used by the shader so is optimized out. - for (var i = 0; i < this._packedGeometryPoolSize; i++) - { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { /* eslint-disable max-len */ this._packedGeometries[i] = new (this.geometryClass)(); } - this.initFlushBuffers(); }; - /** * Makes sure that static and dynamic flush pooled objects have correct dimensions */ - AbstractBatchRenderer.prototype.initFlushBuffers = function initFlushBuffers () - { - var _drawCallPool = AbstractBatchRenderer._drawCallPool; - var _textureArrayPool = AbstractBatchRenderer._textureArrayPool; + AbstractBatchRenderer.prototype.initFlushBuffers = function () { + var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool; // max draw calls var MAX_SPRITES = this.size / 4; // max texture arrays var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1; - - while (_drawCallPool.length < MAX_SPRITES) - { + while (_drawCallPool.length < MAX_SPRITES) { _drawCallPool.push(new BatchDrawCall()); } - while (_textureArrayPool.length < MAX_TA) - { + while (_textureArrayPool.length < MAX_TA) { _textureArrayPool.push(new BatchTextureArray()); } - for (var i = 0; i < this.MAX_TEXTURES; i++) - { + for (var i = 0; i < this.MAX_TEXTURES; i++) { this._tempBoundTextures[i] = null; } }; - /** * Handles the `prerender` signal. * * It ensures that flushes start from the first geometry * object again. */ - AbstractBatchRenderer.prototype.onPrerender = function onPrerender () - { + AbstractBatchRenderer.prototype.onPrerender = function () { this._flushId = 0; }; - /** * Buffers the "batchable" object. It need not be rendered * immediately. @@ -29688,82 +26986,58 @@ var PIXI = (function (exports) { * @param {PIXI.DisplayObject} element - the element to render when * using this renderer */ - AbstractBatchRenderer.prototype.render = function render (element) - { - if (!element._texture.valid) - { + AbstractBatchRenderer.prototype.render = function (element) { + if (!element._texture.valid) { return; } - - if (this._vertexCount + (element.vertexData.length / 2) > this.size) - { + if (this._vertexCount + (element.vertexData.length / 2) > this.size) { this.flush(); } - this._vertexCount += element.vertexData.length / 2; this._indexCount += element.indices.length; this._bufferedTextures[this._bufferSize] = element._texture.baseTexture; this._bufferedElements[this._bufferSize++] = element; }; - - AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function buildTexturesAndDrawCalls () - { - var ref = this; - var textures = ref._bufferedTextures; - var MAX_TEXTURES = ref.MAX_TEXTURES; + AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () { + var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES; var textureArrays = AbstractBatchRenderer._textureArrayPool; var batch = this.renderer.batch; var boundTextures = this._tempBoundTextures; var touch = this.renderer.textureGC.count; - var TICK = ++BaseTexture._globalBatch; var countTexArrays = 0; var texArray = textureArrays[0]; var start = 0; - batch.copyBoundTextures(boundTextures, MAX_TEXTURES); - - for (var i = 0; i < this._bufferSize; ++i) - { + for (var i = 0; i < this._bufferSize; ++i) { var tex = textures[i]; - textures[i] = null; - if (tex._batchEnabled === TICK) - { + if (tex._batchEnabled === TICK) { continue; } - - if (texArray.count >= MAX_TEXTURES) - { + if (texArray.count >= MAX_TEXTURES) { batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); this.buildDrawCalls(texArray, start, i); start = i; texArray = textureArrays[++countTexArrays]; ++TICK; } - tex._batchEnabled = TICK; tex.touched = touch; texArray.elements[texArray.count++] = tex; } - - if (texArray.count > 0) - { + if (texArray.count > 0) { batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES); this.buildDrawCalls(texArray, start, this._bufferSize); ++countTexArrays; ++TICK; } - // Clean-up - - for (var i$1 = 0; i$1 < boundTextures.length; i$1++) - { - boundTextures[i$1] = null; + for (var i = 0; i < boundTextures.length; i++) { + boundTextures[i] = null; } BaseTexture._globalBatch = TICK; }; - /** * Populating drawcalls for rendering * @@ -29771,222 +27045,149 @@ var PIXI = (function (exports) { * @param {number} start * @param {number} finish */ - AbstractBatchRenderer.prototype.buildDrawCalls = function buildDrawCalls (texArray, start, finish) - { - var ref = this; - var elements = ref._bufferedElements; - var _attributeBuffer = ref._attributeBuffer; - var _indexBuffer = ref._indexBuffer; - var vertexSize = ref.vertexSize; + AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) { + var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize; var drawCalls = AbstractBatchRenderer._drawCallPool; - var dcIndex = this._dcIndex; var aIndex = this._aIndex; var iIndex = this._iIndex; - var drawCall = drawCalls[dcIndex]; - drawCall.start = this._iIndex; drawCall.texArray = texArray; - - for (var i = start; i < finish; ++i) - { + for (var i = start; i < finish; ++i) { var sprite = elements[i]; var tex = sprite._texture.baseTexture; - var spriteBlendMode = premultiplyBlendMode[ - tex.alphaMode ? 1 : 0][sprite.blendMode]; - + var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode]; elements[i] = null; - - if (start < i && drawCall.blend !== spriteBlendMode) - { + if (start < i && drawCall.blend !== spriteBlendMode) { drawCall.size = iIndex - drawCall.start; start = i; drawCall = drawCalls[++dcIndex]; drawCall.texArray = texArray; drawCall.start = iIndex; } - this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex); aIndex += sprite.vertexData.length / 2 * vertexSize; iIndex += sprite.indices.length; - drawCall.blend = spriteBlendMode; } - - if (start < finish) - { + if (start < finish) { drawCall.size = iIndex - drawCall.start; ++dcIndex; } - this._dcIndex = dcIndex; this._aIndex = aIndex; this._iIndex = iIndex; }; - /** * Bind textures for current rendering * * @param {PIXI.BatchTextureArray} texArray */ - AbstractBatchRenderer.prototype.bindAndClearTexArray = function bindAndClearTexArray (texArray) - { + AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) { var textureSystem = this.renderer.texture; - - for (var j = 0; j < texArray.count; j++) - { + for (var j = 0; j < texArray.count; j++) { textureSystem.bind(texArray.elements[j], texArray.ids[j]); texArray.elements[j] = null; } texArray.count = 0; }; - - AbstractBatchRenderer.prototype.updateGeometry = function updateGeometry () - { - var ref = this; - var packedGeometries = ref._packedGeometries; - var attributeBuffer = ref._attributeBuffer; - var indexBuffer = ref._indexBuffer; - - if (!settings.CAN_UPLOAD_SAME_BUFFER) - { /* Usually on iOS devices, where the browser doesn't + AbstractBatchRenderer.prototype.updateGeometry = function () { + var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer; + if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't like uploads to the same buffer in a single frame. */ - if (this._packedGeometryPoolSize <= this._flushId) - { + if (this._packedGeometryPoolSize <= this._flushId) { this._packedGeometryPoolSize++; packedGeometries[this._flushId] = new (this.geometryClass)(); } - packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.bind(packedGeometries[this._flushId]); this.renderer.geometry.updateBuffers(); this._flushId++; } - else - { + else { // lets use the faster option, always use buffer number 0 packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData); packedGeometries[this._flushId]._indexBuffer.update(indexBuffer); - this.renderer.geometry.updateBuffers(); } }; - - AbstractBatchRenderer.prototype.drawBatches = function drawBatches () - { + AbstractBatchRenderer.prototype.drawBatches = function () { var dcCount = this._dcIndex; - var ref = this.renderer; - var gl = ref.gl; - var stateSystem = ref.state; + var _a = this.renderer, gl = _a.gl, stateSystem = _a.state; var drawCalls = AbstractBatchRenderer._drawCallPool; - var curTexArray = null; - // Upload textures and do the draw calls - for (var i = 0; i < dcCount; i++) - { - var ref$1 = drawCalls[i]; - var texArray = ref$1.texArray; - var type = ref$1.type; - var size = ref$1.size; - var start = ref$1.start; - var blend = ref$1.blend; - - if (curTexArray !== texArray) - { + for (var i = 0; i < dcCount; i++) { + var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend; + if (curTexArray !== texArray) { curTexArray = texArray; this.bindAndClearTexArray(texArray); } - this.state.blendMode = blend; stateSystem.set(this.state); gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2); } }; - /** * Renders the content _now_ and empties the current batch. */ - AbstractBatchRenderer.prototype.flush = function flush () - { - if (this._vertexCount === 0) - { + AbstractBatchRenderer.prototype.flush = function () { + if (this._vertexCount === 0) { return; } - this._attributeBuffer = this.getAttributeBuffer(this._vertexCount); this._indexBuffer = this.getIndexBuffer(this._indexCount); this._aIndex = 0; this._iIndex = 0; this._dcIndex = 0; - this.buildTexturesAndDrawCalls(); this.updateGeometry(); this.drawBatches(); - // reset elements buffer for the next flush this._bufferSize = 0; this._vertexCount = 0; this._indexCount = 0; }; - /** * Starts a new sprite batch. */ - AbstractBatchRenderer.prototype.start = function start () - { + AbstractBatchRenderer.prototype.start = function () { this.renderer.state.set(this.state); - this.renderer.shader.bind(this._shader); - - if (settings.CAN_UPLOAD_SAME_BUFFER) - { + if (settings.CAN_UPLOAD_SAME_BUFFER) { // bind buffer #0, we don't need others this.renderer.geometry.bind(this._packedGeometries[this._flushId]); } }; - /** * Stops and flushes the current batch. */ - AbstractBatchRenderer.prototype.stop = function stop () - { + AbstractBatchRenderer.prototype.stop = function () { this.flush(); }; - /** * Destroys this `AbstractBatchRenderer`. It cannot be used again. */ - AbstractBatchRenderer.prototype.destroy = function destroy () - { - for (var i = 0; i < this._packedGeometryPoolSize; i++) - { - if (this._packedGeometries[i]) - { + AbstractBatchRenderer.prototype.destroy = function () { + for (var i = 0; i < this._packedGeometryPoolSize; i++) { + if (this._packedGeometries[i]) { this._packedGeometries[i].destroy(); } } - this.renderer.off('prerender', this.onPrerender, this); - this._aBuffers = null; this._iBuffers = null; this._packedGeometries = null; this._attributeBuffer = null; this._indexBuffer = null; - - if (this._shader) - { + if (this._shader) { this._shader.destroy(); this._shader = null; } - - ObjectRenderer.prototype.destroy.call(this); + _super.prototype.destroy.call(this); }; - /** * Fetches an attribute buffer from `this._aBuffers` that * can hold atleast `size` floats. @@ -29995,59 +27196,43 @@ var PIXI = (function (exports) { * @return {ViewableBuffer} - buffer than can hold atleast `size` floats * @private */ - AbstractBatchRenderer.prototype.getAttributeBuffer = function getAttributeBuffer (size) - { + AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) { // 8 vertices is enough for 2 quads var roundedP2 = nextPow2(Math.ceil(size / 8)); var roundedSizeIndex = log2(roundedP2); var roundedSize = roundedP2 * 8; - - if (this._aBuffers.length <= roundedSizeIndex) - { + if (this._aBuffers.length <= roundedSizeIndex) { this._iBuffers.length = roundedSizeIndex + 1; } - var buffer = this._aBuffers[roundedSize]; - - if (!buffer) - { + if (!buffer) { this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4); } - return buffer; }; - /** * Fetches an index buffer from `this._iBuffers` that can - * has atleast `size` capacity. + * have at least `size` capacity. * * @param {number} size - minimum required capacity * @return {Uint16Array} - buffer that can fit `size` * indices. * @private */ - AbstractBatchRenderer.prototype.getIndexBuffer = function getIndexBuffer (size) - { + AbstractBatchRenderer.prototype.getIndexBuffer = function (size) { // 12 indices is enough for 2 quads var roundedP2 = nextPow2(Math.ceil(size / 12)); var roundedSizeIndex = log2(roundedP2); var roundedSize = roundedP2 * 12; - - if (this._iBuffers.length <= roundedSizeIndex) - { + if (this._iBuffers.length <= roundedSizeIndex) { this._iBuffers.length = roundedSizeIndex + 1; } - var buffer = this._iBuffers[roundedSizeIndex]; - - if (!buffer) - { + if (!buffer) { this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize); } - return buffer; }; - /** * Takes the four batching parameters of `element`, interleaves * and pushes them into the batching attribute/index buffers given. @@ -30062,26 +27247,20 @@ var PIXI = (function (exports) { * @param {number} aIndex - number of floats already in the attribute buffer * @param {number} iIndex - number of indices already in `indexBuffer` */ - AbstractBatchRenderer.prototype.packInterleavedGeometry = function packInterleavedGeometry (element, attributeBuffer, indexBuffer, aIndex, iIndex) - { - var uint32View = attributeBuffer.uint32View; - var float32View = attributeBuffer.float32View; - + AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) { + var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View; var packedVertices = aIndex / this.vertexSize; var uvs = element.uvs; var indicies = element.indices; var vertexData = element.vertexData; var textureId = element._texture.baseTexture._batchLocation; - var alpha = Math.min(element.worldAlpha, 1.0); var argb = (alpha < 1.0 && element._texture.baseTexture.alphaMode) ? premultiplyTint(element._tintRGB, alpha) : element._tintRGB + (alpha * 255 << 24); - // lets not worry about tint! for now.. - for (var i = 0; i < vertexData.length; i += 2) - { + for (var i = 0; i < vertexData.length; i += 2) { float32View[aIndex++] = vertexData[i]; float32View[aIndex++] = vertexData[i + 1]; float32View[aIndex++] = uvs[i]; @@ -30089,135 +27268,108 @@ var PIXI = (function (exports) { uint32View[aIndex++] = argb; float32View[aIndex++] = textureId; } - - for (var i$1 = 0; i$1 < indicies.length; i$1++) - { - indexBuffer[iIndex++] = packedVertices + indicies[i$1]; + for (var i = 0; i < indicies.length; i++) { + indexBuffer[iIndex++] = packedVertices + indicies[i]; } }; - + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * + * @static + * @member {PIXI.BatchDrawCall[]} + */ + AbstractBatchRenderer._drawCallPool = []; + /** + * Pool of `BatchDrawCall` objects that `flush` used + * to create "batches" of the objects being rendered. + * + * These are never re-allocated again. + * Shared between all batch renderers because it can be only one "flush" working at the moment. + * + * @static + * @member {PIXI.BatchTextureArray[]} + */ + AbstractBatchRenderer._textureArrayPool = []; return AbstractBatchRenderer; }(ObjectRenderer)); - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchDrawCall[]} - */ - AbstractBatchRenderer._drawCallPool = []; - - /** - * Pool of `BatchDrawCall` objects that `flush` used - * to create "batches" of the objects being rendered. - * - * These are never re-allocated again. - * Shared between all batch renderers because it can be only one "flush" working at the moment. - * - * @static - * @member {PIXI.BatchTextureArray[]} - */ - AbstractBatchRenderer._textureArrayPool = []; - /** * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer * * @class * @memberof PIXI */ - var BatchShaderGenerator = function BatchShaderGenerator(vertexSrc, fragTemplate) - { + var BatchShaderGenerator = /** @class */ (function () { /** - * Reference to the vertex shader source. - * - * @member {string} + * @param {string} vertexSrc - Vertex shader + * @param {string} fragTemplate - Fragment shader template */ - this.vertexSrc = vertexSrc; - - /** - * Reference to the fragement shader template. Must contain "%count%" and "%forloop%". - * - * @member {string} - */ - this.fragTemplate = fragTemplate; - - this.programCache = {}; - this.defaultGroupCache = {}; - - if (fragTemplate.indexOf('%count%') < 0) - { - throw new Error('Fragment template must contain "%count%".'); - } - - if (fragTemplate.indexOf('%forloop%') < 0) - { - throw new Error('Fragment template must contain "%forloop%".'); - } - }; - - BatchShaderGenerator.prototype.generateShader = function generateShader (maxTextures) - { - if (!this.programCache[maxTextures]) - { - var sampleValues = new Int32Array(maxTextures); - - for (var i = 0; i < maxTextures; i++) - { - sampleValues[i] = i; + function BatchShaderGenerator(vertexSrc, fragTemplate) { + /** + * Reference to the vertex shader source. + * + * @member {string} + */ + this.vertexSrc = vertexSrc; + /** + * Reference to the fragement shader template. Must contain "%count%" and "%forloop%". + * + * @member {string} + */ + this.fragTemplate = fragTemplate; + this.programCache = {}; + this.defaultGroupCache = {}; + if (fragTemplate.indexOf('%count%') < 0) { + throw new Error('Fragment template must contain "%count%".'); + } + if (fragTemplate.indexOf('%forloop%') < 0) { + throw new Error('Fragment template must contain "%forloop%".'); } - - this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); - - var fragmentSrc = this.fragTemplate; - - fragmentSrc = fragmentSrc.replace(/%count%/gi, ("" + maxTextures)); - fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); - - this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); } - - var uniforms = { - tint: new Float32Array([1, 1, 1, 1]), - translationMatrix: new Matrix(), - default: this.defaultGroupCache[maxTextures], + BatchShaderGenerator.prototype.generateShader = function (maxTextures) { + if (!this.programCache[maxTextures]) { + var sampleValues = new Int32Array(maxTextures); + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true); + var fragmentSrc = this.fragTemplate; + fragmentSrc = fragmentSrc.replace(/%count%/gi, "" + maxTextures); + fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc); + } + var uniforms = { + tint: new Float32Array([1, 1, 1, 1]), + translationMatrix: new Matrix(), + default: this.defaultGroupCache[maxTextures], + }; + return new Shader(this.programCache[maxTextures], uniforms); }; - - return new Shader(this.programCache[maxTextures], uniforms); - }; - - BatchShaderGenerator.prototype.generateSampleSrc = function generateSampleSrc (maxTextures) - { - var src = ''; - - src += '\n'; - src += '\n'; - - for (var i = 0; i < maxTextures; i++) - { - if (i > 0) - { - src += '\nelse '; + BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + for (var i = 0; i < maxTextures; i++) { + if (i > 0) { + src += '\nelse '; + } + if (i < maxTextures - 1) { + src += "if(vTextureId < " + i + ".5)"; + } + src += '\n{'; + src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; + src += '\n}'; } - - if (i < maxTextures - 1) - { - src += "if(vTextureId < " + i + ".5)"; - } - - src += '\n{'; - src += "\n\tcolor = texture2D(uSamplers[" + i + "], vTextureCoord);"; - src += '\n}'; - } - - src += '\n'; - src += '\n'; - - return src; - }; + src += '\n'; + src += '\n'; + return src; + }; + return BatchShaderGenerator; + }()); /** * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects). @@ -30225,40 +27377,36 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var BatchGeometry = /*@__PURE__*/(function (Geometry) { - function BatchGeometry(_static) - { - if ( _static === void 0 ) { _static = false; } - - Geometry.call(this); - + var BatchGeometry = /** @class */ (function (_super) { + __extends$2(BatchGeometry, _super); + /** + * @param {boolean} [_static=false] - Optimization flag, where `false` + * is updated every frame, `true` doesn't change frame-to-frame. + */ + function BatchGeometry(_static) { + if (_static === void 0) { _static = false; } + var _this = _super.call(this) || this; /** * Buffer used for position, color, texture IDs * * @member {PIXI.Buffer} * @protected */ - this._buffer = new Buffer(null, _static, false); - + _this._buffer = new Buffer(null, _static, false); /** * Index buffer data * * @member {PIXI.Buffer} * @protected */ - this._indexBuffer = new Buffer(null, _static, true); - - this.addAttribute('aVertexPosition', this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', this._buffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aColor', this._buffer, 4, true, exports.TYPES.UNSIGNED_BYTE) - .addAttribute('aTextureId', this._buffer, 1, true, exports.TYPES.FLOAT) - .addIndex(this._indexBuffer); + _this._indexBuffer = new Buffer(null, _static, true); + _this.addAttribute('aVertexPosition', _this._buffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aTextureCoord', _this._buffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aColor', _this._buffer, 4, true, exports.TYPES.UNSIGNED_BYTE) + .addAttribute('aTextureId', _this._buffer, 1, true, exports.TYPES.FLOAT) + .addIndex(_this._indexBuffer); + return _this; } - - if ( Geometry ) { BatchGeometry.__proto__ = Geometry; } - BatchGeometry.prototype = Object.create( Geometry && Geometry.prototype ); - BatchGeometry.prototype.constructor = BatchGeometry; - return BatchGeometry; }(Geometry)); @@ -30271,74 +27419,94 @@ var PIXI = (function (exports) { * @memberof PIXI * @hideconstructor */ - var BatchPluginFactory = function BatchPluginFactory () {}; - - var staticAccessors$1 = { defaultVertexSrc: { configurable: true },defaultFragmentTemplate: { configurable: true } }; - - BatchPluginFactory.create = function create (options) - { - var ref = Object.assign({ - vertex: defaultVertex$2, - fragment: defaultFragment$2, - geometryClass: BatchGeometry, - vertexSize: 6, - }, options); - var vertex = ref.vertex; - var fragment = ref.fragment; - var vertexSize = ref.vertexSize; - var geometryClass = ref.geometryClass; - - return /*@__PURE__*/(function (AbstractBatchRenderer) { - function BatchPlugin(renderer) - { - AbstractBatchRenderer.call(this, renderer); - - this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); - this.geometryClass = geometryClass; - this.vertexSize = vertexSize; - } - - if ( AbstractBatchRenderer ) { BatchPlugin.__proto__ = AbstractBatchRenderer; } - BatchPlugin.prototype = Object.create( AbstractBatchRenderer && AbstractBatchRenderer.prototype ); - BatchPlugin.prototype.constructor = BatchPlugin; - + var BatchPluginFactory = /** @class */ (function () { + function BatchPluginFactory() { + } + /** + * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way + * to extend BatchRenderer with all the necessary pieces. + * @example + * const fragment = ` + * varying vec2 vTextureCoord; + * varying vec4 vColor; + * varying float vTextureId; + * uniform sampler2D uSamplers[%count%]; + * + * void main(void){ + * vec4 color; + * %forloop% + * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a); + * } + * `; + * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment }); + * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer); + * const sprite = new PIXI.Sprite(); + * sprite.pluginName = 'invert'; + * + * @static + * @param {object} [options] + * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source + * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template + * @param {number} [options.vertexSize=6] - Vertex size + * @param {object} [options.geometryClass=PIXI.BatchGeometry] + * @return {*} New batch renderer plugin + */ + BatchPluginFactory.create = function (options) { + var _a = Object.assign({ + vertex: defaultVertex$2, + fragment: defaultFragment$2, + geometryClass: BatchGeometry, + vertexSize: 6, + }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass; + return /** @class */ (function (_super) { + __extends$2(BatchPlugin, _super); + function BatchPlugin(renderer) { + var _this = _super.call(this, renderer) || this; + _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment); + _this.geometryClass = geometryClass; + _this.vertexSize = vertexSize; + return _this; + } return BatchPlugin; }(AbstractBatchRenderer)); - }; - - /** - * The default vertex shader source - * - * @static - * @type {string} - * @constant - */ - staticAccessors$1.defaultVertexSrc.get = function () - { - return defaultVertex$2; - }; - - /** - * The default fragment shader source - * - * @static - * @type {string} - * @constant - */ - staticAccessors$1.defaultFragmentTemplate.get = function () - { - return defaultFragment$2; - }; - - Object.defineProperties( BatchPluginFactory, staticAccessors$1 ); - + }; + Object.defineProperty(BatchPluginFactory, "defaultVertexSrc", { + /** + * The default vertex shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultVertex$2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BatchPluginFactory, "defaultFragmentTemplate", { + /** + * The default fragment shader source + * + * @static + * @type {string} + * @constant + */ + get: function () { + return defaultFragment$2; + }, + enumerable: false, + configurable: true + }); + return BatchPluginFactory; + }()); // Setup the default BatchRenderer plugin, this is what // we'll actually export at the root level var BatchRenderer = BatchPluginFactory.create(); /*! - * @pixi/app - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/app - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/app is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -30362,109 +27530,126 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Application = function Application(options) - { - var this$1 = this; - - // The default options - options = Object.assign({ - forceCanvas: false, - }, options); - + var Application = /** @class */ (function () { /** - * WebGL renderer if available, otherwise CanvasRenderer. - * @member {PIXI.Renderer|PIXI.CanvasRenderer} + * @param {object} [options] - The optional renderer parameters. + * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction. + * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set + * options.sharedTicker to true in case that it is already started. Stop it by your own. + * @param {number} [options.width=800] - The width of the renderers view. + * @param {number} [options.height=600] - The height of the renderers view. + * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional. + * @param {boolean} [options.transparent=false] - If the render view is transparent. + * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for + * resolutions other than 1. + * @param {boolean} [options.antialias=false] - Sets antialias + * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you + * need to call toDataUrl on the WebGL context. + * @param {number} [options.resolution=1] - The resolution / device pixel ratio of the renderer, retina would be 2. + * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this + * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise + * it is ignored. + * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area + * (shown if not transparent). + * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or + * not before the new render pass. + * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to "high-performance" + * for devices with dual graphics card. **(WebGL only)**. + * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker. + * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker. + * The system ticker will always run before both the shared ticker and the app ticker. + * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader. + * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to. */ - this.renderer = autoDetectRenderer(options); - + function Application(options) { + var _this = this; + // The default options + options = Object.assign({ + forceCanvas: false, + }, options); + /** + * WebGL renderer if available, otherwise CanvasRenderer. + * @member {PIXI.Renderer|PIXI.CanvasRenderer} + */ + this.renderer = autoDetectRenderer(options); + /** + * The root display container that's rendered. + * @member {PIXI.Container} + */ + this.stage = new Container(); + // install plugins here + Application._plugins.forEach(function (plugin) { + plugin.init.call(_this, options); + }); + } /** - * The root display container that's rendered. - * @member {PIXI.Container} + * Register a middleware plugin for the application + * @static + * @param {PIXI.Application.Plugin} plugin - Plugin being installed */ - this.stage = new Container(); - - // install plugins here - Application._plugins.forEach(function (plugin) { - plugin.init.call(this$1, options); + Application.registerPlugin = function (plugin) { + Application._plugins.push(plugin); + }; + /** + * Render the current stage. + */ + Application.prototype.render = function () { + // TODO: Since CanvasRenderer has not been converted this function thinks it takes DisplayObject & PIXI.DisplayObject + // This can be fixed when CanvasRenderer is converted. + this.renderer.render(this.stage); + }; + Object.defineProperty(Application.prototype, "view", { + /** + * Reference to the renderer's canvas element. + * @member {HTMLCanvasElement} + * @readonly + */ + get: function () { + return this.renderer.view; + }, + enumerable: false, + configurable: true }); - }; - - var prototypeAccessors$6 = { view: { configurable: true },screen: { configurable: true } }; - - /** - * Register a middleware plugin for the application - * @static - * @param {PIXI.Application.Plugin} plugin - Plugin being installed - */ - Application.registerPlugin = function registerPlugin (plugin) - { - Application._plugins.push(plugin); - }; - - /** - * Render the current stage. - */ - Application.prototype.render = function render () - { - this.renderer.render(this.stage); - }; - - /** - * Reference to the renderer's canvas element. - * @member {HTMLCanvasElement} - * @readonly - */ - prototypeAccessors$6.view.get = function () - { - return this.renderer.view; - }; - - /** - * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. - * @member {PIXI.Rectangle} - * @readonly - */ - prototypeAccessors$6.screen.get = function () - { - return this.renderer.screen; - }; - - /** - * Destroy and don't use after this. - * @param {Boolean} [removeView=false] Automatically remove canvas from DOM. - * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options - * have been set to that value - * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy - * method called as well. 'stageOptions' will be passed on to those calls. - * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the texture of the child sprite - * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set - * to true. Should it destroy the base texture of the child sprite - */ - Application.prototype.destroy = function destroy (removeView, stageOptions) - { - var this$1 = this; - - // Destroy plugins in the opposite order - // which they were constructed - var plugins = Application._plugins.slice(0); - - plugins.reverse(); - plugins.forEach(function (plugin) { - plugin.destroy.call(this$1); + Object.defineProperty(Application.prototype, "screen", { + /** + * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen. + * @member {PIXI.Rectangle} + * @readonly + */ + get: function () { + return this.renderer.screen; + }, + enumerable: false, + configurable: true }); - - this.stage.destroy(stageOptions); - this.stage = null; - - this.renderer.destroy(removeView); - this.renderer = null; - - this._options = null; - }; - - Object.defineProperties( Application.prototype, prototypeAccessors$6 ); - + /** + * Destroy and don't use after this. + * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM. + * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options + * have been set to that value + * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy + * method called as well. 'stageOptions' will be passed on to those calls. + * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the texture of the child sprite + * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set + * to true. Should it destroy the base texture of the child sprite + */ + Application.prototype.destroy = function (removeView, stageOptions) { + var _this = this; + // Destroy plugins in the opposite order + // which they were constructed + var plugins = Application._plugins.slice(0); + plugins.reverse(); + plugins.forEach(function (plugin) { + plugin.destroy.call(_this); + }); + this.stage.destroy(stageOptions); + this.stage = null; + this.renderer.destroy(removeView); + this.renderer = null; + }; + return Application; + }()); /** * @memberof PIXI.Application * @typedef {object} Plugin @@ -30472,7 +27657,6 @@ var PIXI = (function (exports) { * Passes in `options` as the only argument, which are Application constructor options. * @property {function} destroy - Called when destroying Application, scoped to Application instance */ - /** * Collection of installed plugins. * @static @@ -30486,84 +27670,114 @@ var PIXI = (function (exports) { * @private * @class */ - var ResizePlugin = function ResizePlugin () {}; - - ResizePlugin.init = function init (options) - { - var this$1 = this; - + var ResizePlugin = /** @class */ (function () { + function ResizePlugin() { + } /** - * The element or window to resize the application to. - * @type {Window|HTMLElement} - * @name resizeTo - * @memberof PIXI.Application# + * Initialize the plugin with scope of application instance + * @static + * @private + * @param {object} [options] - See application options */ - Object.defineProperty(this, 'resizeTo', - { - set: function set(dom) - { - window.removeEventListener('resize', this.resize); + ResizePlugin.init = function (options) { + var _this = this; + /** + * The HTML element or window to automatically resize the + * renderer's view element to match width and height. + * @type {Window|HTMLElement} + * @name resizeTo + * @memberof PIXI.Application# + */ + Object.defineProperty(this, 'resizeTo', { + set: function (dom) { + window.removeEventListener('resize', this.queueResize); this._resizeTo = dom; - if (dom) - { - window.addEventListener('resize', this.resize); + if (dom) { + window.addEventListener('resize', this.queueResize); this.resize(); } }, - get: function get() - { + get: function () { return this._resizeTo; }, }); - - /** - * If `resizeTo` is set, calling this function - * will resize to the width and height of that element. - * @method PIXI.Application#resize - */ - this.resize = function () { - if (this$1._resizeTo) - { + /** + * Resize is throttled, so it's + * safe to call this multiple times per frame and it'll + * only be called once. + * @method PIXI.Application#queueResize + */ + this.queueResize = function () { + if (!_this._resizeTo) { + return; + } + _this.cancelResize(); + // // Throttle resize events per raf + _this._resizeId = requestAnimationFrame(function () { return _this.resize(); }); + }; + /** + * Cancel the resize queue. + * @method PIXI.Application#cancelResize + * @private + */ + this.cancelResize = function () { + if (_this._resizeId) { + cancelAnimationFrame(_this._resizeId); + _this._resizeId = null; + } + }; + /** + * Execute an immediate resize on the renderer, this is not + * throttled and can be expensive to call many times in a row. + * Will resize only if `resizeTo` property is set. + * @method PIXI.Application#resize + */ + this.resize = function () { + if (!_this._resizeTo) { + return; + } + // clear queue resize + _this.cancelResize(); + var width; + var height; // Resize to the window - if (this$1._resizeTo === window) - { - this$1.renderer.resize( - window.innerWidth, - window.innerHeight - ); + if (_this._resizeTo === window) { + width = window.innerWidth; + height = window.innerHeight; } // Resize to other HTML entities - else - { - this$1.renderer.resize( - this$1._resizeTo.clientWidth, - this$1._resizeTo.clientHeight - ); + else { + var _a = _this._resizeTo, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight; + width = clientWidth; + height = clientHeight; } - } + _this.renderer.resize(width, height); + }; + // On resize + this._resizeId = null; + this._resizeTo = null; + this.resizeTo = options.resizeTo || null; }; - - // On resize - this._resizeTo = null; - this.resizeTo = options.resizeTo || null; - }; - - /** - * Clean up the ticker, scoped to application - * @static - * @private - */ - ResizePlugin.destroy = function destroy () - { - this.resizeTo = null; - this.resize = null; - }; + /** + * Clean up the ticker, scoped to application + * @static + * @private + */ + ResizePlugin.destroy = function () { + this.cancelResize(); + this.cancelResize = null; + this.queueResize = null; + this.resizeTo = null; + this.resize = null; + }; + return ResizePlugin; + }()); Application.registerPlugin(ResizePlugin); /*! - * @pixi/extract - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/extract - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/extract is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -30571,7 +27785,6 @@ var PIXI = (function (exports) { var TEMP_RECT = new Rectangle(); var BYTES_PER_PIXEL = 4; - /** * This class provides renderer-specific plugins for exporting content from a renderer. * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels). @@ -30593,257 +27806,191 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Extract = function Extract(renderer) - { - this.renderer = renderer; + var Extract = /** @class */ (function () { /** - * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture - * - * @member {PIXI.Extract} extract - * @memberof PIXI.Renderer# - * @see PIXI.Extract + * @param {PIXI.Renderer} renderer - A reference to the current renderer */ - renderer.extract = this; - }; - - /** - * Will return a HTML Image of the target - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {HTMLImageElement} HTML Image of the target - */ - Extract.prototype.image = function image (target, format, quality) - { - var image = new Image(); - - image.src = this.base64(target, format, quality); - - return image; - }; - - /** - * Will return a a base64 encoded string of this target. It works by calling - * `Extract.getCanvas` and then running toDataURL on that. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". - * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. - * @return {string} A base64 encoded string of the texture. - */ - Extract.prototype.base64 = function base64 (target, format, quality) - { - return this.canvas(target).toDataURL(format, quality); - }; - - /** - * Creates a Canvas element, renders this target to it and then returns it. - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. - */ - Extract.prototype.canvas = function canvas (target) - { - var renderer = this.renderer; - var resolution; - var frame; - var flipY = false; - var renderTexture; - var generated = false; - - if (target) - { - if (target instanceof RenderTexture) - { - renderTexture = target; + function Extract(renderer) { + this.renderer = renderer; + /** + * Collection of methods for extracting data (image, pixels, etc.) from a display object or render texture + * + * @member {PIXI.Extract} extract + * @memberof PIXI.Renderer# + * @see PIXI.Extract + */ + renderer.extract = this; + } + /** + * Will return a HTML Image of the target + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". + * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. + * @return {HTMLImageElement} HTML Image of the target + */ + Extract.prototype.image = function (target, format, quality) { + var image = new Image(); + image.src = this.base64(target, format, quality); + return image; + }; + /** + * Will return a a base64 encoded string of this target. It works by calling + * `Extract.getCanvas` and then running toDataURL on that. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @param {string} [format] - Image format, e.g. "image/jpeg" or "image/webp". + * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92. + * @return {string} A base64 encoded string of the texture. + */ + Extract.prototype.base64 = function (target, format, quality) { + return this.canvas(target).toDataURL(format, quality); + }; + /** + * Creates a Canvas element, renders this target to it and then returns it. + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @return {HTMLCanvasElement} A Canvas element with the texture rendered on. + */ + Extract.prototype.canvas = function (target) { + var renderer = this.renderer; + var resolution; + var frame; + var flipY = false; + var renderTexture; + var generated = false; + if (target) { + if (target instanceof RenderTexture) { + renderTexture = target; + } + else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } } - else - { - renderTexture = this.renderer.generateTexture(target); - generated = true; + if (renderTexture) { + resolution = renderTexture.baseTexture.resolution; + frame = renderTexture.frame; + flipY = false; + renderer.renderTexture.bind(renderTexture); } - } - - if (renderTexture) - { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - flipY = false; - renderer.renderTexture.bind(renderTexture); - } - else - { - resolution = this.renderer.resolution; - - flipY = true; - - frame = TEMP_RECT; - frame.width = this.renderer.width; - frame.height = this.renderer.height; - - renderer.renderTexture.bind(null); - } - - var width = Math.floor((frame.width * resolution) + 1e-4); - var height = Math.floor((frame.height * resolution) + 1e-4); - - var canvasBuffer = new CanvasRenderTarget(width, height, 1); - - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - - // read pixels to the array - var gl = renderer.gl; - - gl.readPixels( - frame.x * resolution, - frame.y * resolution, - width, - height, - gl.RGBA, - gl.UNSIGNED_BYTE, - webglPixels - ); - - // add the pixels to the canvas - var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); - - Extract.arrayPostDivide(webglPixels, canvasData.data); - - canvasBuffer.context.putImageData(canvasData, 0, 0); - - // pulling pixels - if (flipY) - { - canvasBuffer.context.scale(1, -1); - canvasBuffer.context.drawImage(canvasBuffer.canvas, 0, -height); - } - - if (generated) - { - renderTexture.destroy(true); - } - - // send the canvas back.. - return canvasBuffer.canvas; - }; - - /** - * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA - * order, with integer values between 0 and 255 (included). - * - * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture - * to convert. If left empty will use the main renderer - * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture - */ - Extract.prototype.pixels = function pixels (target) - { - var renderer = this.renderer; - var resolution; - var frame; - var renderTexture; - var generated = false; - - if (target) - { - if (target instanceof RenderTexture) - { - renderTexture = target; + else { + resolution = this.renderer.resolution; + flipY = true; + frame = TEMP_RECT; + frame.width = this.renderer.width; + frame.height = this.renderer.height; + renderer.renderTexture.bind(null); } - else - { - renderTexture = this.renderer.generateTexture(target); - generated = true; + var width = Math.floor((frame.width * resolution) + 1e-4); + var height = Math.floor((frame.height * resolution) + 1e-4); + var canvasBuffer = new CanvasRenderTarget(width, height, 1); + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + // add the pixels to the canvas + var canvasData = canvasBuffer.context.getImageData(0, 0, width, height); + Extract.arrayPostDivide(webglPixels, canvasData.data); + canvasBuffer.context.putImageData(canvasData, 0, 0); + // pulling pixels + if (flipY) { + var target_1 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1); + target_1.context.scale(1, -1); + // we can't render to itself because we should be empty before render. + target_1.context.drawImage(canvasBuffer.canvas, 0, -height); + canvasBuffer.destroy(); + canvasBuffer = target_1; } - } - - if (renderTexture) - { - resolution = renderTexture.baseTexture.resolution; - frame = renderTexture.frame; - - // bind the buffer - renderer.renderTexture.bind(renderTexture); - } - else - { - resolution = renderer.resolution; - - frame = TEMP_RECT; - frame.width = renderer.width; - frame.height = renderer.height; - - renderer.renderTexture.bind(null); - } - - var width = frame.width * resolution; - var height = frame.height * resolution; - - var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); - - // read pixels to the array - var gl = renderer.gl; - - gl.readPixels( - frame.x * resolution, - frame.y * resolution, - width, - height, - gl.RGBA, - gl.UNSIGNED_BYTE, - webglPixels - ); - - if (generated) - { - renderTexture.destroy(true); - } - - Extract.arrayPostDivide(webglPixels, webglPixels); - - return webglPixels; - }; - - /** - * Destroys the extract - * - */ - Extract.prototype.destroy = function destroy () - { - this.renderer.extract = null; - this.renderer = null; - }; - - /** - * Takes premultiplied pixel data and produces regular pixel data - * - * @private - * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data - * @param out {number[] | Uint8Array | Uint8ClampedArray} output array - */ - Extract.arrayPostDivide = function arrayPostDivide (pixels, out) - { - for (var i = 0; i < pixels.length; i += 4) - { - var alpha = out[i + 3] = pixels[i + 3]; - - if (alpha !== 0) - { - out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0)); - out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0)); - out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0)); + if (generated) { + renderTexture.destroy(true); } - else - { - out[i] = pixels[i]; - out[i + 1] = pixels[i + 1]; - out[i + 2] = pixels[i + 2]; + // send the canvas back.. + return canvasBuffer.canvas; + }; + /** + * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA + * order, with integer values between 0 and 255 (included). + * + * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture + * to convert. If left empty will use the main renderer + * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture + */ + Extract.prototype.pixels = function (target) { + var renderer = this.renderer; + var resolution; + var frame; + var renderTexture; + var generated = false; + if (target) { + if (target instanceof RenderTexture) { + renderTexture = target; + } + else { + renderTexture = this.renderer.generateTexture(target); + generated = true; + } } - } - }; + if (renderTexture) { + resolution = renderTexture.baseTexture.resolution; + frame = renderTexture.frame; + // bind the buffer + renderer.renderTexture.bind(renderTexture); + } + else { + resolution = renderer.resolution; + frame = TEMP_RECT; + frame.width = renderer.width; + frame.height = renderer.height; + renderer.renderTexture.bind(null); + } + var width = frame.width * resolution; + var height = frame.height * resolution; + var webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height); + // read pixels to the array + var gl = renderer.gl; + gl.readPixels(frame.x * resolution, frame.y * resolution, width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels); + if (generated) { + renderTexture.destroy(true); + } + Extract.arrayPostDivide(webglPixels, webglPixels); + return webglPixels; + }; + /** + * Destroys the extract + * + */ + Extract.prototype.destroy = function () { + this.renderer.extract = null; + this.renderer = null; + }; + /** + * Takes premultiplied pixel data and produces regular pixel data + * + * @private + * @param pixels {number[] | Uint8Array | Uint8ClampedArray} array of pixel data + * @param out {number[] | Uint8Array | Uint8ClampedArray} output array + */ + Extract.arrayPostDivide = function (pixels, out) { + for (var i = 0; i < pixels.length; i += 4) { + var alpha = out[i + 3] = pixels[i + 3]; + if (alpha !== 0) { + out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0)); + out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0)); + out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0)); + } + else { + out[i] = pixels[i]; + out[i + 1] = pixels[i + 1]; + out[i + 2] = pixels[i + 2]; + } + } + }; + return Extract; + }()); 'use strict'; @@ -33384,34 +30531,75 @@ var PIXI = (function (exports) { }; /*! - * @pixi/loaders - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/loaders - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/loaders is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /** + * Reference to **{@link https://github.com/englercj/resource-loader + * resource-loader}**'s Resource class. + * @see http://englercj.github.io/resource-loader/Resource.html + * @class LoaderResource + * @memberof PIXI + */ + var LoaderResource = Resource$1; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$3 = function(d, b) { + extendStatics$3 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$3(d, b); + }; + + function __extends$3(d, b) { + extendStatics$3(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + /** * Loader plugin for handling Texture resources. * @class * @memberof PIXI * @implements PIXI.ILoaderPlugin */ - var TextureLoader = function TextureLoader () {}; - - TextureLoader.use = function use (resource, next) - { - // create a new texture if the data is an Image object - if (resource.data && resource.type === Resource$1.TYPE.IMAGE) - { - resource.texture = Texture.fromLoader( - resource.data, - resource.url, - resource.name - ); + var TextureLoader = /** @class */ (function () { + function TextureLoader() { } - next(); - }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + TextureLoader.use = function (resource, next) { + // create a new texture if the data is an Image object + if (resource.data && resource.type === Resource$1.TYPE.IMAGE) { + resource.texture = Texture.fromLoader(resource.data, resource.url, resource.name); + } + next(); + }; + return TextureLoader; + }()); /** * The new loader, extends Resource Loader by Chad Engler: https://github.com/englercj/resource-loader @@ -33464,175 +30652,156 @@ var PIXI = (function (exports) { * @param {string} [baseUrl=''] - The base url for all resources loaded by this loader. * @param {number} [concurrency=10] - The number of resources to load concurrently. */ - var Loader$1 = /*@__PURE__*/(function (ResourceLoader) { - function Loader(baseUrl, concurrency) - { - var this$1 = this; - - ResourceLoader.call(this, baseUrl, concurrency); - eventemitter3.call(this); - - for (var i = 0; i < Loader._plugins.length; ++i) - { + var Loader$1 = /** @class */ (function (_super) { + __extends$3(Loader, _super); + function Loader(baseUrl, concurrency) { + var _this = _super.call(this, baseUrl, concurrency) || this; + for (var i = 0; i < Loader._plugins.length; ++i) { var plugin = Loader._plugins[i]; - var pre = plugin.pre; - var use = plugin.use; - - if (pre) - { - this.pre(pre); + var pre = plugin.pre, use = plugin.use; + if (pre) { + _this.pre(pre); } - - if (use) - { - this.use(use); + if (use) { + _this.use(use); } } - - // Compat layer, translate the new v2 signals into old v1 events. - this.onStart.add(function (l) { return this$1.emit('start', l); }); - this.onProgress.add(function (l, r) { return this$1.emit('progress', l, r); }); - this.onError.add(function (e, l, r) { return this$1.emit('error', e, l, r); }); - this.onLoad.add(function (l, r) { return this$1.emit('load', l, r); }); - this.onComplete.add(function (l, r) { return this$1.emit('complete', l, r); }); - /** * If this loader cannot be destroyed. * @member {boolean} * @default false * @private */ - this._protected = false; + _this._protected = false; + return _this; } - - if ( ResourceLoader ) { Loader.__proto__ = ResourceLoader; } - Loader.prototype = Object.create( ResourceLoader && ResourceLoader.prototype ); - Loader.prototype.constructor = Loader; - - var staticAccessors = { shared: { configurable: true } }; - /** * Destroy the loader, removes references. - * @private + * @memberof PIXI.Loader# + * @method destroy + * @public */ - Loader.prototype.destroy = function destroy () - { - if (!this._protected) - { - this.removeAllListeners(); + Loader.prototype.destroy = function () { + if (!this._protected) { this.reset(); } }; - + Object.defineProperty(Loader, "shared", { + /** + * A premade instance of the loader that can be used to load resources. + * @name shared + * @type {PIXI.Loader} + * @static + * @memberof PIXI.Loader + */ + get: function () { + var shared = Loader._shared; + if (!shared) { + shared = new Loader(); + shared._protected = true; + Loader._shared = shared; + } + return shared; + }, + enumerable: false, + configurable: true + }); /** - * A premade instance of the loader that can be used to load resources. - * @name shared - * @type {PIXI.Loader} + * Adds a Loader plugin for the global shared loader and all + * new Loader instances created. + * * @static + * @method registerPlugin * @memberof PIXI.Loader + * @param {PIXI.ILoaderPlugin} plugin - The plugin to add + * @return {PIXI.Loader} Reference to PIXI.Loader for chaining */ - staticAccessors.shared.get = function () - { - var shared = Loader._shared; - - if (!shared) - { - shared = new Loader(); - shared._protected = true; - Loader._shared = shared; + Loader.registerPlugin = function (plugin) { + Loader._plugins.push(plugin); + if (plugin.add) { + plugin.add(); } - - return shared; + return Loader; }; - - Object.defineProperties( Loader, staticAccessors ); - + /** + * Collection of all installed `use` middleware for Loader. + * + * @static + * @member {Array} _plugins + * @memberof PIXI.Loader + * @private + */ + Loader._plugins = []; return Loader; }(Loader)); - - // Copy EE3 prototype (mixin) - Object.assign(Loader$1.prototype, eventemitter3.prototype); - - /** - * Collection of all installed `use` middleware for Loader. - * - * @static - * @member {Array} _plugins - * @memberof PIXI.Loader - * @private - */ - Loader$1._plugins = []; - - /** - * Adds a Loader plugin for the global shared loader and all - * new Loader instances created. - * - * @static - * @method registerPlugin - * @memberof PIXI.Loader - * @param {PIXI.ILoaderPlugin} plugin - The plugin to add - * @return {PIXI.Loader} Reference to PIXI.Loader for chaining - */ - Loader$1.registerPlugin = function registerPlugin(plugin) - { - Loader$1._plugins.push(plugin); - - if (plugin.add) - { - plugin.add(); - } - - return Loader$1; - }; - // parse any blob into more usable objects (e.g. Image) Loader$1.registerPlugin({ use: index$1.parsing }); - // parse any Image objects into textures Loader$1.registerPlugin(TextureLoader); - /** * Plugin to be installed for handling specific Loader resources. * * @memberof PIXI - * @typedef ILoaderPlugin + * @typedef {object} ILoaderPlugin * @property {function} [add] - Function to call immediate after registering plugin. * @property {PIXI.Loader.loaderMiddleware} [pre] - Middleware function to run before load, the * arguments for this are `(resource, next)` * @property {PIXI.Loader.loaderMiddleware} [use] - Middleware function to run after load, the * arguments for this are `(resource, next)` */ - + /** + * @memberof PIXI.Loader + * @typedef {object} ICallbackID + */ + /** + * @memberof PIXI.Loader + * @typedef {function} ISignalCallback + * @param {function} callback - Callback function + * @param {object} [context] - Context + * @returns {ICallbackID} - CallbackID + */ + /** + * @memberof PIXI.Loader + * @typedef {function} ISignalDetach + * @param {ICallbackID} id - CallbackID returned by `add`/`once` methods + */ + /** + * @memberof PIXI.Loader + * @typedef ILoaderSignal + * @property {ISignalCallback} add - Register callback + * @property {ISignalCallback} once - Register oneshot callback + * @property {ISignalDetach} detach - Detach specific callback by ID + */ /** * @memberof PIXI.Loader * @callback loaderMiddleware * @param {PIXI.LoaderResource} resource * @param {function} next */ - /** * @memberof PIXI.Loader# - * @member {object} onStart + * @description Dispatched when the loader begins to loading process. + * @member {PIXI.Loader.ILoaderSignal} onStart */ - /** * @memberof PIXI.Loader# - * @member {object} onProgress + * @description Dispatched once per loaded or errored resource. + * @member {PIXI.Loader.ILoaderSignal} onProgress */ - /** * @memberof PIXI.Loader# - * @member {object} onError + * @description Dispatched once per errored resource. + * @member {PIXI.Loader.ILoaderSignal} onError */ - /** * @memberof PIXI.Loader# - * @member {object} onLoad + * @description Dispatched once per loaded resource. + * @member {PIXI.Loader.ILoaderSignal} onLoad */ - /** * @memberof PIXI.Loader# - * @member {object} onComplete + * @description Dispatched when completely loaded all resources. + * @member {PIXI.Loader.ILoaderSignal} onComplete */ /** @@ -33645,53 +30814,76 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var AppLoaderPlugin = function AppLoaderPlugin () {}; - - AppLoaderPlugin.init = function init (options) - { - options = Object.assign({ - sharedLoader: false, - }, options); - - /** - * Loader instance to help with asset loading. - * @name PIXI.Application#loader - * @type {PIXI.Loader} - * @readonly - */ - this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); - }; - - /** - * Called when application destroyed - * @private - */ - AppLoaderPlugin.destroy = function destroy () - { - if (this.loader) - { - this.loader.destroy(); - this.loader = null; + var AppLoaderPlugin = /** @class */ (function () { + function AppLoaderPlugin() { } - }; - - /** - * Reference to **{@link https://github.com/englercj/resource-loader - * resource-loader}**'s Resource class. - * @see http://englercj.github.io/resource-loader/Resource.html - * @class LoaderResource - * @memberof PIXI - */ - var LoaderResource = Resource$1; + /** + * Called on application constructor + * @param {object} options + * @private + */ + AppLoaderPlugin.init = function (options) { + options = Object.assign({ + sharedLoader: false, + }, options); + /** + * Loader instance to help with asset loading. + * @name PIXI.Application#loader + * @type {PIXI.Loader} + * @readonly + */ + this.loader = options.sharedLoader ? Loader$1.shared : new Loader$1(); + }; + /** + * Called when application destroyed + * @private + */ + AppLoaderPlugin.destroy = function () { + if (this.loader) { + this.loader.destroy(); + this.loader = null; + } + }; + return AppLoaderPlugin; + }()); /*! - * @pixi/particles - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/particles - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/particles is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$4 = function(d, b) { + extendStatics$4 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$4(d, b); + }; + + function __extends$4(d, b) { + extendStatics$4(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + /** * The ParticleContainer class is a really fast version of the Container built solely for speed, * so use when you need a lot of sprites or particles. @@ -33719,71 +30911,73 @@ var PIXI = (function (exports) { * @extends PIXI.Container * @memberof PIXI */ - var ParticleContainer = /*@__PURE__*/(function (Container) { - function ParticleContainer(maxSize, properties, batchSize, autoResize) - { - if ( maxSize === void 0 ) { maxSize = 1500; } - if ( batchSize === void 0 ) { batchSize = 16384; } - if ( autoResize === void 0 ) { autoResize = false; } - - Container.call(this); - + var ParticleContainer = /** @class */ (function (_super) { + __extends$4(ParticleContainer, _super); + /** + * @param {number} [maxSize=1500] - The maximum number of particles that can be rendered by the container. + * Affects size of allocated buffers. + * @param {object} [properties] - The properties of children that should be uploaded to the gpu and applied. + * @param {boolean} [properties.vertices=false] - When true, vertices be uploaded and applied. + * if sprite's ` scale/anchor/trim/frame/orig` is dynamic, please set `true`. + * @param {boolean} [properties.position=true] - When true, position be uploaded and applied. + * @param {boolean} [properties.rotation=false] - When true, rotation be uploaded and applied. + * @param {boolean} [properties.uvs=false] - When true, uvs be uploaded and applied. + * @param {boolean} [properties.tint=false] - When true, alpha and tint be uploaded and applied. + * @param {number} [batchSize=16384] - Number of particles per batch. If less than maxSize, it uses maxSize instead. + * @param {boolean} [autoResize=false] - If true, container allocates more batches in case + * there are more than `maxSize` particles. + */ + function ParticleContainer(maxSize, properties, batchSize, autoResize) { + if (maxSize === void 0) { maxSize = 1500; } + if (batchSize === void 0) { batchSize = 16384; } + if (autoResize === void 0) { autoResize = false; } + var _this = _super.call(this) || this; // Making sure the batch size is valid // 65535 is max vertex index in the index buffer (see ParticleRenderer) // so max number of particles is 65536 / 4 = 16384 var maxBatchSize = 16384; - - if (batchSize > maxBatchSize) - { + if (batchSize > maxBatchSize) { batchSize = maxBatchSize; } - /** * Set properties to be dynamic (true) / static (false) * * @member {boolean[]} * @private */ - this._properties = [false, true, false, false, false]; - + _this._properties = [false, true, false, false, false]; /** * @member {number} * @private */ - this._maxSize = maxSize; - + _this._maxSize = maxSize; /** * @member {number} * @private */ - this._batchSize = batchSize; - + _this._batchSize = batchSize; /** * @member {Array} * @private */ - this._buffers = null; - + _this._buffers = null; /** * for every batch stores _updateID corresponding to the last change in that batch * @member {number[]} * @private */ - this._bufferUpdateIDs = []; - + _this._bufferUpdateIDs = []; /** * when child inserted, removed or changes position this number goes up * @member {number[]} * @private */ - this._updateID = 0; - + _this._updateID = 0; /** * @member {boolean} * */ - this.interactiveChildren = false; - + _this.interactiveChildren = false; /** * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` * to reset the blend mode. @@ -33792,15 +30986,13 @@ var PIXI = (function (exports) { * @default PIXI.BLEND_MODES.NORMAL * @see PIXI.BLEND_MODES */ - this.blendMode = exports.BLEND_MODES.NORMAL; - + _this.blendMode = exports.BLEND_MODES.NORMAL; /** * If true, container allocates more batches in case there are more than `maxSize` particles. * @member {boolean} * @default false */ - this.autoResize = autoResize; - + _this.autoResize = autoResize; /** * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. * Advantages can include sharper image quality (like text) and faster rendering on canvas. @@ -33810,18 +31002,15 @@ var PIXI = (function (exports) { * @member {boolean} * @default true */ - this.roundPixels = true; - + _this.roundPixels = true; /** * The texture used to render the children. * * @readonly * @member {PIXI.BaseTexture} */ - this.baseTexture = null; - - this.setProperties(properties); - + _this.baseTexture = null; + _this.setProperties(properties); /** * The tint applied to the container. * This is a hex value. A value of 0xFFFFFF will remove any tint effect. @@ -33830,26 +31019,18 @@ var PIXI = (function (exports) { * @member {number} * @default 0xFFFFFF */ - this._tint = 0; - this.tintRgb = new Float32Array(4); - this.tint = 0xFFFFFF; + _this._tint = 0; + _this.tintRgb = new Float32Array(4); + _this.tint = 0xFFFFFF; + return _this; } - - if ( Container ) { ParticleContainer.__proto__ = Container; } - ParticleContainer.prototype = Object.create( Container && Container.prototype ); - ParticleContainer.prototype.constructor = ParticleContainer; - - var prototypeAccessors = { tint: { configurable: true } }; - /** * Sets the private properties array to dynamic / static based on the passed properties object * * @param {object} properties - The properties to be uploaded */ - ParticleContainer.prototype.setProperties = function setProperties (properties) - { - if (properties) - { + ParticleContainer.prototype.setProperties = function (properties) { + if (properties) { this._properties[0] = 'vertices' in properties || 'scale' in properties ? !!properties.vertices || !!properties.scale : this._properties[0]; this._properties[1] = 'position' in properties ? !!properties.position : this._properties[1]; @@ -33859,95 +31040,74 @@ var PIXI = (function (exports) { ? !!properties.tint || !!properties.alpha : this._properties[4]; } }; - /** * Updates the object transform for rendering * * @private */ - ParticleContainer.prototype.updateTransform = function updateTransform () - { + ParticleContainer.prototype.updateTransform = function () { // TODO don't need to! this.displayObjectUpdateTransform(); - // PIXI.Container.prototype.updateTransform.call( this ); }; - - /** - * The tint applied to the container. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.get = function () - { - return this._tint; - }; - - prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc - { - this._tint = value; - hex2rgb(value, this.tintRgb); - }; - + Object.defineProperty(ParticleContainer.prototype, "tint", { + /** + * The tint applied to the container. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + ** IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + hex2rgb(value, this.tintRgb); + }, + enumerable: false, + configurable: true + }); /** * Renders the container using the WebGL renderer * * @private * @param {PIXI.Renderer} renderer - The webgl renderer */ - ParticleContainer.prototype.render = function render (renderer) - { - var this$1 = this; - - if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) - { + ParticleContainer.prototype.render = function (renderer) { + var _this = this; + if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable) { return; } - - if (!this.baseTexture) - { + if (!this.baseTexture) { this.baseTexture = this.children[0]._texture.baseTexture; - if (!this.baseTexture.valid) - { - this.baseTexture.once('update', function () { return this$1.onChildrenChange(0); }); + if (!this.baseTexture.valid) { + this.baseTexture.once('update', function () { return _this.onChildrenChange(0); }); } } - renderer.batch.setObjectRenderer(renderer.plugins.particle); renderer.plugins.particle.render(this); }; - /** * Set the flag that static data should be updated to true * * @private * @param {number} smallestChildIndex - The smallest child index */ - ParticleContainer.prototype.onChildrenChange = function onChildrenChange (smallestChildIndex) - { + ParticleContainer.prototype.onChildrenChange = function (smallestChildIndex) { var bufferIndex = Math.floor(smallestChildIndex / this._batchSize); - - while (this._bufferUpdateIDs.length < bufferIndex) - { + while (this._bufferUpdateIDs.length < bufferIndex) { this._bufferUpdateIDs.push(0); } this._bufferUpdateIDs[bufferIndex] = ++this._updateID; }; - - ParticleContainer.prototype.dispose = function dispose () - { - if (this._buffers) - { - for (var i = 0; i < this._buffers.length; ++i) - { + ParticleContainer.prototype.dispose = function () { + if (this._buffers) { + for (var i = 0; i < this._buffers.length; ++i) { this._buffers[i].destroy(); } - this._buffers = null; } }; - /** * Destroys the container * @@ -33960,19 +31120,13 @@ var PIXI = (function (exports) { * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true * Should it destroy the base texture of the child sprite */ - ParticleContainer.prototype.destroy = function destroy (options) - { - Container.prototype.destroy.call(this, options); - + ParticleContainer.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); this.dispose(); - this._properties = null; this._buffers = null; this._bufferUpdateIDs = null; }; - - Object.defineProperties( ParticleContainer.prototype, prototypeAccessors ); - return ParticleContainer; }(Container)); @@ -33987,7 +31141,6 @@ var PIXI = (function (exports) { * Heavily inspired by LibGDX's ParticleBuffer: * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java */ - /** * The particle buffer manages the static and dynamic buffers for a particle container. * @@ -33995,235 +31148,170 @@ var PIXI = (function (exports) { * @private * @memberof PIXI */ - var ParticleBuffer = function ParticleBuffer(properties, dynamicPropertyFlags, size) - { - this.geometry = new Geometry(); - - this.indexBuffer = null; - + var ParticleBuffer = /** @class */ (function () { /** - * The number of particles the buffer can hold - * * @private - * @member {number} + * @param {object} properties - The properties to upload. + * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic. + * @param {number} size - The size of the batch. */ - this.size = size; - - /** - * A list of the properties that are dynamic. - * - * @private - * @member {object[]} - */ - this.dynamicProperties = []; - - /** - * A list of the properties that are static. - * - * @private - * @member {object[]} - */ - this.staticProperties = []; - - for (var i = 0; i < properties.length; ++i) - { - var property = properties[i]; - - // Make copy of properties object so that when we edit the offset it doesn't - // change all other instances of the object literal - property = { - attributeName: property.attributeName, - size: property.size, - uploadFunction: property.uploadFunction, - type: property.type || exports.TYPES.FLOAT, - offset: property.offset, - }; - - if (dynamicPropertyFlags[i]) - { - this.dynamicProperties.push(property); - } - else - { - this.staticProperties.push(property); + function ParticleBuffer(properties, dynamicPropertyFlags, size) { + this.geometry = new Geometry(); + this.indexBuffer = null; + /** + * The number of particles the buffer can hold + * + * @private + * @member {number} + */ + this.size = size; + /** + * A list of the properties that are dynamic. + * + * @private + * @member {object[]} + */ + this.dynamicProperties = []; + /** + * A list of the properties that are static. + * + * @private + * @member {object[]} + */ + this.staticProperties = []; + for (var i = 0; i < properties.length; ++i) { + var property = properties[i]; + // Make copy of properties object so that when we edit the offset it doesn't + // change all other instances of the object literal + property = { + attributeName: property.attributeName, + size: property.size, + uploadFunction: property.uploadFunction, + type: property.type || exports.TYPES.FLOAT, + offset: property.offset, + }; + if (dynamicPropertyFlags[i]) { + this.dynamicProperties.push(property); + } + else { + this.staticProperties.push(property); + } } + this.staticStride = 0; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + this.dynamicStride = 0; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + this._updateID = 0; + this.initBuffers(); } - - this.staticStride = 0; - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - - this.dynamicStride = 0; - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - - this._updateID = 0; - - this.initBuffers(); - }; - - /** - * Sets up the renderer context and necessary buffers. - * - * @private - */ - ParticleBuffer.prototype.initBuffers = function initBuffers () - { - var geometry = this.geometry; - - var dynamicOffset = 0; - /** - * Holds the indices of the geometry (quads) to draw + * Sets up the renderer context and necessary buffers. * - * @member {Uint16Array} * @private */ - this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); - geometry.addIndex(this.indexBuffer); - - this.dynamicStride = 0; - - for (var i = 0; i < this.dynamicProperties.length; ++i) - { - var property = this.dynamicProperties[i]; - - property.offset = dynamicOffset; - dynamicOffset += property.size; - this.dynamicStride += property.size; - } - - var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); - - this.dynamicData = new Float32Array(dynBuffer); - this.dynamicDataUint32 = new Uint32Array(dynBuffer); - this.dynamicBuffer = new Buffer(this.dynamicData, false, false); - - // static // - var staticOffset = 0; - - this.staticStride = 0; - - for (var i$1 = 0; i$1 < this.staticProperties.length; ++i$1) - { - var property$1 = this.staticProperties[i$1]; - - property$1.offset = staticOffset; - staticOffset += property$1.size; - this.staticStride += property$1.size; - } - - var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); - - this.staticData = new Float32Array(statBuffer); - this.staticDataUint32 = new Uint32Array(statBuffer); - this.staticBuffer = new Buffer(this.staticData, true, false); - - for (var i$2 = 0; i$2 < this.dynamicProperties.length; ++i$2) - { - var property$2 = this.dynamicProperties[i$2]; - - geometry.addAttribute( - property$2.attributeName, - this.dynamicBuffer, - 0, - property$2.type === exports.TYPES.UNSIGNED_BYTE, - property$2.type, - this.dynamicStride * 4, - property$2.offset * 4 - ); - } - - for (var i$3 = 0; i$3 < this.staticProperties.length; ++i$3) - { - var property$3 = this.staticProperties[i$3]; - - geometry.addAttribute( - property$3.attributeName, - this.staticBuffer, - 0, - property$3.type === exports.TYPES.UNSIGNED_BYTE, - property$3.type, - this.staticStride * 4, - property$3.offset * 4 - ); - } - }; - - /** - * Uploads the dynamic properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadDynamic = function uploadDynamic (children, startIndex, amount) - { - for (var i = 0; i < this.dynamicProperties.length; i++) - { - var property = this.dynamicProperties[i]; - - property.uploadFunction(children, startIndex, amount, - property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, - this.dynamicStride, property.offset); - } - - this.dynamicBuffer._updateID++; - }; - - /** - * Uploads the static properties. - * - * @private - * @param {PIXI.DisplayObject[]} children - The children to upload. - * @param {number} startIndex - The index to start at. - * @param {number} amount - The number to upload. - */ - ParticleBuffer.prototype.uploadStatic = function uploadStatic (children, startIndex, amount) - { - for (var i = 0; i < this.staticProperties.length; i++) - { - var property = this.staticProperties[i]; - - property.uploadFunction(children, startIndex, amount, - property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, - this.staticStride, property.offset); - } - - this.staticBuffer._updateID++; - }; - - /** - * Destroys the ParticleBuffer. - * - * @private - */ - ParticleBuffer.prototype.destroy = function destroy () - { - this.indexBuffer = null; - - this.dynamicProperties = null; - // this.dynamicBuffer.destroy(); - this.dynamicBuffer = null; - this.dynamicData = null; - this.dynamicDataUint32 = null; - - this.staticProperties = null; - // this.staticBuffer.destroy(); - this.staticBuffer = null; - this.staticData = null; - this.staticDataUint32 = null; - // all buffers are destroyed inside geometry - this.geometry.destroy(); - }; - - var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; + ParticleBuffer.prototype.initBuffers = function () { + var geometry = this.geometry; + var dynamicOffset = 0; + /** + * Holds the indices of the geometry (quads) to draw + * + * @member {Uint16Array} + * @private + */ + this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true); + geometry.addIndex(this.indexBuffer); + this.dynamicStride = 0; + for (var i = 0; i < this.dynamicProperties.length; ++i) { + var property = this.dynamicProperties[i]; + property.offset = dynamicOffset; + dynamicOffset += property.size; + this.dynamicStride += property.size; + } + var dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); + this.dynamicData = new Float32Array(dynBuffer); + this.dynamicDataUint32 = new Uint32Array(dynBuffer); + this.dynamicBuffer = new Buffer(this.dynamicData, false, false); + // static // + var staticOffset = 0; + this.staticStride = 0; + for (var i = 0; i < this.staticProperties.length; ++i) { + var property = this.staticProperties[i]; + property.offset = staticOffset; + staticOffset += property.size; + this.staticStride += property.size; + } + var statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4); + this.staticData = new Float32Array(statBuffer); + this.staticDataUint32 = new Uint32Array(statBuffer); + this.staticBuffer = new Buffer(this.staticData, true, false); + for (var i = 0; i < this.dynamicProperties.length; ++i) { + var property = this.dynamicProperties[i]; + geometry.addAttribute(property.attributeName, this.dynamicBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.dynamicStride * 4, property.offset * 4); + } + for (var i = 0; i < this.staticProperties.length; ++i) { + var property = this.staticProperties[i]; + geometry.addAttribute(property.attributeName, this.staticBuffer, 0, property.type === exports.TYPES.UNSIGNED_BYTE, property.type, this.staticStride * 4, property.offset * 4); + } + }; + /** + * Uploads the dynamic properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadDynamic = function (children, startIndex, amount) { + for (var i = 0; i < this.dynamicProperties.length; i++) { + var property = this.dynamicProperties[i]; + property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, property.offset); + } + this.dynamicBuffer._updateID++; + }; + /** + * Uploads the static properties. + * + * @private + * @param {PIXI.DisplayObject[]} children - The children to upload. + * @param {number} startIndex - The index to start at. + * @param {number} amount - The number to upload. + */ + ParticleBuffer.prototype.uploadStatic = function (children, startIndex, amount) { + for (var i = 0; i < this.staticProperties.length; i++) { + var property = this.staticProperties[i]; + property.uploadFunction(children, startIndex, amount, property.type === exports.TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, property.offset); + } + this.staticBuffer._updateID++; + }; + /** + * Destroys the ParticleBuffer. + * + * @private + */ + ParticleBuffer.prototype.destroy = function () { + this.indexBuffer = null; + this.dynamicProperties = null; + this.dynamicBuffer = null; + this.dynamicData = null; + this.dynamicDataUint32 = null; + this.staticProperties = null; + this.staticBuffer = null; + this.staticData = null; + this.staticDataUint32 = null; + // all buffers are destroyed inside geometry + this.geometry.destroy(); + }; + return ParticleBuffer; + }()); var fragment$1 = "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}"; + var vertex$1 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n"; + /** * @author Mat Groves * @@ -34235,62 +31323,59 @@ var PIXI = (function (exports) { * Heavily inspired by LibGDX's ParticleRenderer: * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java */ - /** * Renderer for Particles that is designer for speed over feature set. * * @class * @memberof PIXI */ - var ParticleRenderer = /*@__PURE__*/(function (ObjectRenderer) { - function ParticleRenderer(renderer) - { - ObjectRenderer.call(this, renderer); - + var ParticleRenderer = /** @class */ (function (_super) { + __extends$4(ParticleRenderer, _super); + /** + * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for. + */ + function ParticleRenderer(renderer) { + var _this = _super.call(this, renderer) || this; // 65535 is max vertex index in the index buffer (see ParticleRenderer) // so max number of particles is 65536 / 4 = 16384 // and max number of element in the index buffer is 16384 * 6 = 98304 // Creating a full index buffer, overhead is 98304 * 2 = 196Ko // let numIndices = 98304; - /** * The default shader that is used if a sprite doesn't have a more specific one. * * @member {PIXI.Shader} */ - this.shader = null; - - this.properties = null; - - this.tempMatrix = new Matrix(); - - this.properties = [ + _this.shader = null; + _this.properties = null; + _this.tempMatrix = new Matrix(); + _this.properties = [ // verticesData { attributeName: 'aVertexPosition', size: 2, - uploadFunction: this.uploadVertices, + uploadFunction: _this.uploadVertices, offset: 0, }, // positionData { attributeName: 'aPositionCoord', size: 2, - uploadFunction: this.uploadPosition, + uploadFunction: _this.uploadPosition, offset: 0, }, // rotationData { attributeName: 'aRotation', size: 1, - uploadFunction: this.uploadRotation, + uploadFunction: _this.uploadRotation, offset: 0, }, // uvsData { attributeName: 'aTextureCoord', size: 2, - uploadFunction: this.uploadUvs, + uploadFunction: _this.uploadUvs, offset: 0, }, // tintData @@ -34298,113 +31383,76 @@ var PIXI = (function (exports) { attributeName: 'aColor', size: 1, type: exports.TYPES.UNSIGNED_BYTE, - uploadFunction: this.uploadTint, + uploadFunction: _this.uploadTint, offset: 0, } ]; - - this.shader = Shader.from(vertex$1, fragment$1, {}); - + _this.shader = Shader.from(vertex$1, fragment$1, {}); /** * The WebGL state in which this renderer will work. * * @member {PIXI.State} * @readonly */ - this.state = State.for2d(); + _this.state = State.for2d(); + return _this; } - - if ( ObjectRenderer ) { ParticleRenderer.__proto__ = ObjectRenderer; } - ParticleRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype ); - ParticleRenderer.prototype.constructor = ParticleRenderer; - /** * Renders the particle container object. * * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer */ - ParticleRenderer.prototype.render = function render (container) - { + ParticleRenderer.prototype.render = function (container) { var children = container.children; var maxSize = container._maxSize; var batchSize = container._batchSize; var renderer = this.renderer; var totalChildren = children.length; - - if (totalChildren === 0) - { + if (totalChildren === 0) { return; } - else if (totalChildren > maxSize && !container.autoResize) - { + else if (totalChildren > maxSize && !container.autoResize) { totalChildren = maxSize; } - var buffers = container._buffers; - - if (!buffers) - { + if (!buffers) { buffers = container._buffers = this.generateBuffers(container); } - var baseTexture = children[0]._texture.baseTexture; - // if the uvs have not updated then no point rendering just yet! this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode); renderer.state.set(this.state); - var gl = renderer.gl; - var m = container.worldTransform.copyTo(this.tempMatrix); - m.prepend(renderer.globalUniforms.uniforms.projectionMatrix); - this.shader.uniforms.translationMatrix = m.toArray(true); - - this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, - container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); - + this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb, container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode); this.shader.uniforms.uSampler = baseTexture; - this.renderer.shader.bind(this.shader); - var updateStatic = false; - // now lets upload and render the buffers.. - for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) - { + for (var i = 0, j = 0; i < totalChildren; i += batchSize, j += 1) { var amount = (totalChildren - i); - - if (amount > batchSize) - { + if (amount > batchSize) { amount = batchSize; } - - if (j >= buffers.length) - { + if (j >= buffers.length) { buffers.push(this._generateOneMoreBuffer(container)); } - var buffer = buffers[j]; - // we always upload the dynamic buffer.uploadDynamic(children, i, amount); - var bid = container._bufferUpdateIDs[j] || 0; - updateStatic = updateStatic || (buffer._updateID < bid); // we only upload the static content when we have to! - if (updateStatic) - { + if (updateStatic) { buffer._updateID = container._updateID; buffer.uploadStatic(children, i, amount); } - // bind the buffer renderer.geometry.bind(buffer.geometry); gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0); } }; - /** * Creates one particle buffer for each child in the container we want to render and updates internal properties * @@ -34412,21 +31460,16 @@ var PIXI = (function (exports) { * @return {PIXI.ParticleBuffer[]} The buffers * @private */ - ParticleRenderer.prototype.generateBuffers = function generateBuffers (container) - { + ParticleRenderer.prototype.generateBuffers = function (container) { var buffers = []; var size = container._maxSize; var batchSize = container._batchSize; var dynamicPropertyFlags = container._properties; - - for (var i = 0; i < size; i += batchSize) - { + for (var i = 0; i < size; i += batchSize) { buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize)); } - return buffers; }; - /** * Creates one more particle buffer, because container has autoResize feature * @@ -34434,14 +31477,11 @@ var PIXI = (function (exports) { * @return {PIXI.ParticleBuffer} generated buffer * @private */ - ParticleRenderer.prototype._generateOneMoreBuffer = function _generateOneMoreBuffer (container) - { + ParticleRenderer.prototype._generateOneMoreBuffer = function (container) { var batchSize = container._batchSize; var dynamicPropertyFlags = container._properties; - return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize); }; - /** * Uploads the vertices. * @@ -34452,57 +31492,43 @@ var PIXI = (function (exports) { * @param {number} stride - Stride to use for iteration. * @param {number} offset - Offset to start at. */ - ParticleRenderer.prototype.uploadVertices = function uploadVertices (children, startIndex, amount, array, stride, offset) - { + ParticleRenderer.prototype.uploadVertices = function (children, startIndex, amount, array, stride, offset) { var w0 = 0; var w1 = 0; var h0 = 0; var h1 = 0; - - for (var i = 0; i < amount; ++i) - { + for (var i = 0; i < amount; ++i) { var sprite = children[startIndex + i]; var texture = sprite._texture; var sx = sprite.scale.x; var sy = sprite.scale.y; var trim = texture.trim; var orig = texture.orig; - - if (trim) - { + if (trim) { // if the sprite is trimmed and is not a tilingsprite then we need to add the // extra space before transforming the sprite coords.. w1 = trim.x - (sprite.anchor.x * orig.width); w0 = w1 + trim.width; - h1 = trim.y - (sprite.anchor.y * orig.height); h0 = h1 + trim.height; } - else - { + else { w0 = (orig.width) * (1 - sprite.anchor.x); w1 = (orig.width) * -sprite.anchor.x; - h0 = orig.height * (1 - sprite.anchor.y); h1 = orig.height * -sprite.anchor.y; } - array[offset] = w1 * sx; array[offset + 1] = h1 * sy; - array[offset + stride] = w0 * sx; array[offset + stride + 1] = h1 * sy; - array[offset + (stride * 2)] = w0 * sx; array[offset + (stride * 2) + 1] = h0 * sy; - array[offset + (stride * 3)] = w1 * sx; array[offset + (stride * 3) + 1] = h0 * sy; - offset += stride * 4; } }; - /** * Uploads the position. * @@ -34513,30 +31539,22 @@ var PIXI = (function (exports) { * @param {number} stride - Stride to use for iteration. * @param {number} offset - Offset to start at. */ - ParticleRenderer.prototype.uploadPosition = function uploadPosition (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; i++) - { + ParticleRenderer.prototype.uploadPosition = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { var spritePosition = children[startIndex + i].position; - array[offset] = spritePosition.x; array[offset + 1] = spritePosition.y; - array[offset + stride] = spritePosition.x; array[offset + stride + 1] = spritePosition.y; - array[offset + (stride * 2)] = spritePosition.x; array[offset + (stride * 2) + 1] = spritePosition.y; - array[offset + (stride * 3)] = spritePosition.x; array[offset + (stride * 3) + 1] = spritePosition.y; - offset += stride * 4; } }; - /** - * Uploads the rotiation. + * Uploads the rotation. * * @param {PIXI.DisplayObject[]} children - the array of display objects to render * @param {number} startIndex - the index to start from in the children array @@ -34545,21 +31563,16 @@ var PIXI = (function (exports) { * @param {number} stride - Stride to use for iteration. * @param {number} offset - Offset to start at. */ - ParticleRenderer.prototype.uploadRotation = function uploadRotation (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; i++) - { + ParticleRenderer.prototype.uploadRotation = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; i++) { var spriteRotation = children[startIndex + i].rotation; - array[offset] = spriteRotation; array[offset + stride] = spriteRotation; array[offset + (stride * 2)] = spriteRotation; array[offset + (stride * 3)] = spriteRotation; - offset += stride * 4; } }; - /** * Uploads the Uvs * @@ -34570,48 +31583,34 @@ var PIXI = (function (exports) { * @param {number} stride - Stride to use for iteration. * @param {number} offset - Offset to start at. */ - ParticleRenderer.prototype.uploadUvs = function uploadUvs (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; ++i) - { + ParticleRenderer.prototype.uploadUvs = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { var textureUvs = children[startIndex + i]._texture._uvs; - - if (textureUvs) - { + if (textureUvs) { array[offset] = textureUvs.x0; array[offset + 1] = textureUvs.y0; - array[offset + stride] = textureUvs.x1; array[offset + stride + 1] = textureUvs.y1; - array[offset + (stride * 2)] = textureUvs.x2; array[offset + (stride * 2) + 1] = textureUvs.y2; - array[offset + (stride * 3)] = textureUvs.x3; array[offset + (stride * 3) + 1] = textureUvs.y3; - offset += stride * 4; } - else - { + else { // TODO you know this can be easier! array[offset] = 0; array[offset + 1] = 0; - array[offset + stride] = 0; array[offset + stride + 1] = 0; - array[offset + (stride * 2)] = 0; array[offset + (stride * 2) + 1] = 0; - array[offset + (stride * 3)] = 0; array[offset + (stride * 3) + 1] = 0; - offset += stride * 4; } } }; - /** * Uploads the tint. * @@ -34622,53 +31621,82 @@ var PIXI = (function (exports) { * @param {number} stride - Stride to use for iteration. * @param {number} offset - Offset to start at. */ - ParticleRenderer.prototype.uploadTint = function uploadTint (children, startIndex, amount, array, stride, offset) - { - for (var i = 0; i < amount; ++i) - { + ParticleRenderer.prototype.uploadTint = function (children, startIndex, amount, array, stride, offset) { + for (var i = 0; i < amount; ++i) { var sprite = children[startIndex + i]; var premultiplied = sprite._texture.baseTexture.alphaMode > 0; var alpha = sprite.alpha; // we dont call extra function if alpha is 1.0, that's faster - var argb = alpha < 1.0 && premultiplied ? premultiplyTint(sprite._tintRGB, alpha) - : sprite._tintRGB + (alpha * 255 << 24); - + var argb = alpha < 1.0 && premultiplied + ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24); array[offset] = argb; array[offset + stride] = argb; array[offset + (stride * 2)] = argb; array[offset + (stride * 3)] = argb; - offset += stride * 4; } }; - /** * Destroys the ParticleRenderer. */ - ParticleRenderer.prototype.destroy = function destroy () - { - ObjectRenderer.prototype.destroy.call(this); - - if (this.shader) - { + ParticleRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + if (this.shader) { this.shader.destroy(); this.shader = null; } - this.tempMatrix = null; }; - return ParticleRenderer; }(ObjectRenderer)); /*! - * @pixi/graphics - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/graphics - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/graphics is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /** + * Supported line joints in `PIXI.LineStyle` for graphics. + * + * @see PIXI.Graphics#lineStyle + * @see https://graphicdesign.stackexchange.com/questions/59018/what-is-a-bevel-join-of-two-lines-exactly-illustrator + * + * @name LINE_JOIN + * @memberof PIXI + * @static + * @enum {string} + * @property {string} MITER - 'miter': make a sharp corner where outer part of lines meet + * @property {string} BEVEL - 'bevel': add a square butt at each end of line segment and fill the triangle at turn + * @property {string} ROUND - 'round': add an arc at the joint + */ + + (function (LINE_JOIN) { + LINE_JOIN["MITER"] = "miter"; + LINE_JOIN["BEVEL"] = "bevel"; + LINE_JOIN["ROUND"] = "round"; + })(exports.LINE_JOIN || (exports.LINE_JOIN = {})); + /** + * Support line caps in `PIXI.LineStyle` for graphics. + * + * @see PIXI.Graphics#lineStyle + * + * @name LINE_CAP + * @memberof PIXI + * @static + * @enum {string} + * @property {string} BUTT - 'butt': don't add any cap at line ends (leaves orthogonal edges) + * @property {string} ROUND - 'round': add semicircle at ends + * @property {string} SQUARE - 'square': add square at end (like `BUTT` except more length at end) + */ + + (function (LINE_CAP) { + LINE_CAP["BUTT"] = "butt"; + LINE_CAP["ROUND"] = "round"; + LINE_CAP["SQUARE"] = "square"; + })(exports.LINE_CAP || (exports.LINE_CAP = {})); /** * Graphics curves resolution settings. If `adaptive` flag is set to `true`, * the resolution is calculated based on the curve's length to ensure better visual quality. @@ -34689,26 +31717,19 @@ var PIXI = (function (exports) { maxLength: 10, minSegments: 8, maxSegments: 2048, - _segmentsCount: function _segmentsCount(length, defaultSegments) - { - if ( defaultSegments === void 0 ) { defaultSegments = 20; } - - if (!this.adaptive || !length || Number.isNaN(length)) - { + epsilon: 0.0001, + _segmentsCount: function (length, defaultSegments) { + if (defaultSegments === void 0) { defaultSegments = 20; } + if (!this.adaptive || !length || isNaN(length)) { return defaultSegments; } - var result = Math.ceil(length / this.maxLength); - - if (result < this.minSegments) - { + if (result < this.minSegments) { result = this.minSegments; } - else if (result > this.maxSegments) - { + else if (result > this.maxSegments) { result = this.maxSegments; } - return result; }, }; @@ -34719,83 +31740,107 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var FillStyle = function FillStyle() - { - this.reset(); - }; - - /** - * Clones the object - * - * @return {PIXI.FillStyle} - */ - FillStyle.prototype.clone = function clone () - { - var obj = new FillStyle(); - - obj.color = this.color; - obj.alpha = this.alpha; - obj.texture = this.texture; - obj.matrix = this.matrix; - obj.visible = this.visible; - - return obj; - }; - - /** - * Reset - */ - FillStyle.prototype.reset = function reset () - { + var FillStyle = /** @class */ (function () { + function FillStyle() { + /** + * The hex color value used when coloring the Graphics object. + * + * @member {number} + * @default 0xFFFFFF + */ + this.color = 0xFFFFFF; + /** + * The alpha value used when filling the Graphics object. + * + * @member {number} + * @default 1 + */ + this.alpha = 1.0; + /** + * The texture to be used for the fill. + * + * @member {PIXI.Texture} + * @default 0 + */ + this.texture = Texture.WHITE; + /** + * The transform aplpied to the texture. + * + * @member {PIXI.Matrix} + * @default null + */ + this.matrix = null; + /** + * If the current fill is visible. + * + * @member {boolean} + * @default false + */ + this.visible = false; + this.reset(); + } /** - * The hex color value used when coloring the Graphics object. + * Clones the object * - * @member {number} - * @default 1 + * @return {PIXI.FillStyle} */ - this.color = 0xFFFFFF; - + FillStyle.prototype.clone = function () { + var obj = new FillStyle(); + obj.color = this.color; + obj.alpha = this.alpha; + obj.texture = this.texture; + obj.matrix = this.matrix; + obj.visible = this.visible; + return obj; + }; /** - * The alpha value used when filling the Graphics object. - * - * @member {number} - * @default 1 + * Reset */ - this.alpha = 1; - + FillStyle.prototype.reset = function () { + this.color = 0xFFFFFF; + this.alpha = 1; + this.texture = Texture.WHITE; + this.matrix = null; + this.visible = false; + }; /** - * The texture to be used for the fill. - * - * @member {string} - * @default 0 + * Destroy and don't use after this */ - this.texture = Texture.WHITE; + FillStyle.prototype.destroy = function () { + this.texture = null; + this.matrix = null; + }; + return FillStyle; + }()); - /** - * The transform aplpied to the texture. - * - * @member {string} - * @default 0 - */ - this.matrix = null; - - /** - * If the current fill is visible. - * - * @member {boolean} - * @default false - */ - this.visible = false; - }; - - /** - * Destroy and don't use after this - */ - FillStyle.prototype.destroy = function destroy () - { - this.texture = null; - this.matrix = null; - }; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$5 = function(d, b) { + extendStatics$5 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$5(d, b); + }; + + function __extends$5(d, b) { + extendStatics$5(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } /** * Builds a polygon to draw @@ -34809,57 +31854,41 @@ var PIXI = (function (exports) { * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ var buildPoly = { - - build: function build(graphicsData) - { + build: function (graphicsData) { graphicsData.points = graphicsData.shape.points.slice(); }, - - triangulate: function triangulate(graphicsData, graphicsGeometry) - { + triangulate: function (graphicsData, graphicsGeometry) { var points = graphicsData.points; var holes = graphicsData.holes; var verts = graphicsGeometry.points; var indices = graphicsGeometry.indices; - - if (points.length >= 6) - { + if (points.length >= 6) { var holeArray = []; // Process holes.. - - for (var i = 0; i < holes.length; i++) - { + for (var i = 0; i < holes.length; i++) { var hole = holes[i]; - holeArray.push(points.length / 2); points = points.concat(hole.points); } - // sort color var triangles = earcut_1(points, holeArray, 2); - - if (!triangles) - { + if (!triangles) { return; } - var vertPos = verts.length / 2; - - for (var i$1 = 0; i$1 < triangles.length; i$1 += 3) - { - indices.push(triangles[i$1] + vertPos); - indices.push(triangles[i$1 + 1] + vertPos); - indices.push(triangles[i$1 + 2] + vertPos); + for (var i = 0; i < triangles.length; i += 3) { + indices.push(triangles[i] + vertPos); + indices.push(triangles[i + 1] + vertPos); + indices.push(triangles[i + 2] + vertPos); } - - for (var i$2 = 0; i$2 < points.length; i$2++) - { - verts.push(points[i$2]); + for (var i = 0; i < points.length; i++) { + verts.push(points[i]); } } }, }; + // for type only /** * Builds a circle to draw * @@ -34872,9 +31901,7 @@ var PIXI = (function (exports) { * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ var buildCircle = { - - build: function build(graphicsData) - { + build: function (graphicsData) { // need to convert points to a nice regular data var circleData = graphicsData.shape; var points = graphicsData.points; @@ -34882,62 +31909,43 @@ var PIXI = (function (exports) { var y = circleData.y; var width; var height; - points.length = 0; - // TODO - bit hacky?? - if (graphicsData.type === exports.SHAPES.CIRC) - { + if (graphicsData.type === exports.SHAPES.CIRC) { width = circleData.radius; height = circleData.radius; } - else - { - width = circleData.width; - height = circleData.height; + else { + var ellipseData = graphicsData.shape; + width = ellipseData.width; + height = ellipseData.height; } - - if (width === 0 || height === 0) - { + if (width === 0 || height === 0) { return; } - var totalSegs = Math.floor(30 * Math.sqrt(circleData.radius)) - || Math.floor(15 * Math.sqrt(circleData.width + circleData.height)); - + || Math.floor(15 * Math.sqrt(width + height)); totalSegs /= 2.3; - var seg = (Math.PI * 2) / totalSegs; - - for (var i = 0; i < totalSegs - 0.5; i++) - { - points.push( - x + (Math.sin(-seg * i) * width), - y + (Math.cos(-seg * i) * height) - ); + for (var i = 0; i < totalSegs - 0.5; i++) { + points.push(x + (Math.sin(-seg * i) * width), y + (Math.cos(-seg * i) * height)); } - - points.push( - points[0], - points[1] - ); + points.push(points[0], points[1]); }, - - triangulate: function triangulate(graphicsData, graphicsGeometry) - { + triangulate: function (graphicsData, graphicsGeometry) { var points = graphicsData.points; var verts = graphicsGeometry.points; var indices = graphicsGeometry.indices; - var vertPos = verts.length / 2; var center = vertPos; - - verts.push(graphicsData.shape.x, graphicsData.shape.y); - - for (var i = 0; i < points.length; i += 2) - { + var circle = (graphicsData.shape); + var matrix = graphicsData.matrix; + var x = circle.x; + var y = circle.y; + // Push center (special point) + verts.push(graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x, graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y); + for (var i = 0; i < points.length; i += 2) { verts.push(points[i], points[i + 1]); - // add some uvs indices.push(vertPos++, center, vertPos); } @@ -34956,9 +31964,7 @@ var PIXI = (function (exports) { * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ var buildRectangle = { - - build: function build(graphicsData) - { + build: function (graphicsData) { // --- // // need to convert points to a nice regular data // @@ -34967,105 +31973,16 @@ var PIXI = (function (exports) { var y = rectData.y; var width = rectData.width; var height = rectData.height; - var points = graphicsData.points; - points.length = 0; - - points.push(x, y, - x + width, y, - x + width, y + height, - x, y + height); + points.push(x, y, x + width, y, x + width, y + height, x, y + height); }, - - triangulate: function triangulate(graphicsData, graphicsGeometry) - { + triangulate: function (graphicsData, graphicsGeometry) { var points = graphicsData.points; var verts = graphicsGeometry.points; - var vertPos = verts.length / 2; - - verts.push(points[0], points[1], - points[2], points[3], - points[6], points[7], - points[4], points[5]); - - graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, - vertPos + 1, vertPos + 2, vertPos + 3); - }, - }; - - /** - * Builds a rounded rectangle to draw - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @private - * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape - * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines - */ - var buildRoundedRectangle = { - - build: function build(graphicsData) - { - var rrectData = graphicsData.shape; - var points = graphicsData.points; - var x = rrectData.x; - var y = rrectData.y; - var width = rrectData.width; - var height = rrectData.height; - - var radius = rrectData.radius; - - points.length = 0; - - quadraticBezierCurve(x, y + radius, - x, y, - x + radius, y, - points); - quadraticBezierCurve(x + width - radius, - y, x + width, y, - x + width, y + radius, - points); - quadraticBezierCurve(x + width, y + height - radius, - x + width, y + height, - x + width - radius, y + height, - points); - quadraticBezierCurve(x + radius, y + height, - x, y + height, - x, y + height - radius, - points); - - // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. - // TODO - fix this properly, this is not very elegant.. but it works for now. - }, - - triangulate: function triangulate(graphicsData, graphicsGeometry) - { - var points = graphicsData.points; - - var verts = graphicsGeometry.points; - var indices = graphicsGeometry.indices; - - var vecPos = verts.length / 2; - - var triangles = earcut_1(points, null, 2); - - for (var i = 0, j = triangles.length; i < j; i += 3) - { - indices.push(triangles[i] + vecPos); - // indices.push(triangles[i] + vecPos); - indices.push(triangles[i + 1] + vecPos); - // indices.push(triangles[i + 2] + vecPos); - indices.push(triangles[i + 2] + vecPos); - } - - for (var i$1 = 0, j$1 = points.length; i$1 < j$1; i$1++) - { - verts.push(points[i$1], points[++i$1]); - } + verts.push(points[0], points[1], points[2], points[3], points[6], points[7], points[4], points[5]); + graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2, vertPos + 1, vertPos + 2, vertPos + 3); }, }; @@ -35082,13 +31999,10 @@ var PIXI = (function (exports) { * @return {number} the result * */ - function getPt(n1, n2, perc) - { + function getPt(n1, n2, perc) { var diff = n2 - n1; - return n1 + (diff * perc); } - /** * Calculate the points for a quadratic bezier curve. (helper function..) * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c @@ -35106,62 +32020,198 @@ var PIXI = (function (exports) { * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created. * @return {number[]} an array of points */ - function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) - { - if ( out === void 0 ) { out = []; } - + function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY, out) { + if (out === void 0) { out = []; } var n = 20; var points = out; - var xa = 0; var ya = 0; var xb = 0; var yb = 0; var x = 0; var y = 0; - - for (var i = 0, j = 0; i <= n; ++i) - { + for (var i = 0, j = 0; i <= n; ++i) { j = i / n; - // The Green Line xa = getPt(fromX, cpX, j); ya = getPt(fromY, cpY, j); xb = getPt(cpX, toX, j); yb = getPt(cpY, toY, j); - // The Black Dot x = getPt(xa, xb, j); y = getPt(ya, yb, j); - points.push(x, y); } - return points; } - /** - * Builds a line to draw + * Builds a rounded rectangle to draw * * Ignored from docs since it is not directly exposed. * * @ignore * @private - * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties - * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output + * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines */ - function buildLine(graphicsData, graphicsGeometry) - { - if (graphicsData.lineStyle.native) - { - buildNativeLine(graphicsData, graphicsGeometry); - } - else - { - buildNonNativeLine(graphicsData, graphicsGeometry); - } - } + var buildRoundedRectangle = { + build: function (graphicsData) { + var rrectData = graphicsData.shape; + var points = graphicsData.points; + var x = rrectData.x; + var y = rrectData.y; + var width = rrectData.width; + var height = rrectData.height; + // Don't allow negative radius or greater than half the smallest width + var radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2)); + points.length = 0; + // No radius, do a simple rectangle + if (!radius) { + points.push(x, y, x + width, y, x + width, y + height, x, y + height); + } + else { + quadraticBezierCurve(x, y + radius, x, y, x + radius, y, points); + quadraticBezierCurve(x + width - radius, y, x + width, y, x + width, y + radius, points); + quadraticBezierCurve(x + width, y + height - radius, x + width, y + height, x + width - radius, y + height, points); + quadraticBezierCurve(x + radius, y + height, x, y + height, x, y + height - radius, points); + } + // this tiny number deals with the issue that occurs when points overlap and earcut fails to triangulate the item. + // TODO - fix this properly, this is not very elegant.. but it works for now. + }, + triangulate: function (graphicsData, graphicsGeometry) { + var points = graphicsData.points; + var verts = graphicsGeometry.points; + var indices = graphicsGeometry.indices; + var vecPos = verts.length / 2; + var triangles = earcut_1(points, null, 2); + for (var i = 0, j = triangles.length; i < j; i += 3) { + indices.push(triangles[i] + vecPos); + // indices.push(triangles[i] + vecPos); + indices.push(triangles[i + 1] + vecPos); + // indices.push(triangles[i + 2] + vecPos); + indices.push(triangles[i + 2] + vecPos); + } + for (var i = 0, j = points.length; i < j; i++) { + verts.push(points[i], points[++i]); + } + }, + }; + /** + * Buffers vertices to draw a square cap. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} x - X-coord of end point + * @param {number} y - Y-coord of end point + * @param {number} nx - X-coord of line normal pointing inside + * @param {number} ny - Y-coord of line normal pointing inside + * @param {Array} verts - vertex buffer + * @returns {} + */ + function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, /* rotation for square (true at left end, false at right end) */ verts) { + var ix = x - (nx * innerWeight); + var iy = y - (ny * innerWeight); + var ox = x + (nx * outerWeight); + var oy = y + (ny * outerWeight); + /* Rotate nx,ny for extension vector */ + var exx; + var eyy; + if (clockwise) { + exx = ny; + eyy = -nx; + } + else { + exx = -ny; + eyy = nx; + } + /* [i|0]x,y extended at cap */ + var eix = ix + exx; + var eiy = iy + eyy; + var eox = ox + exx; + var eoy = oy + eyy; + /* Square itself must be inserted clockwise*/ + verts.push(eix, eiy); + verts.push(eox, eoy); + return 2; + } + /** + * Buffers vertices to draw an arc at the line joint or cap. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @private + * @param {number} cx - X-coord of center + * @param {number} cy - Y-coord of center + * @param {number} sx - X-coord of arc start + * @param {number} sy - Y-coord of arc start + * @param {number} ex - X-coord of arc end + * @param {number} ey - Y-coord of arc end + * @param {Array} verts - buffer of vertices + * @param {boolean} clockwise - orientation of vertices + * @returns {number} - no. of vertices pushed + */ + function round(cx, cy, sx, sy, ex, ey, verts, clockwise) { + var cx2p0x = sx - cx; + var cy2p0y = sy - cy; + var angle0 = Math.atan2(cx2p0x, cy2p0y); + var angle1 = Math.atan2(ex - cx, ey - cy); + if (clockwise && angle0 < angle1) { + angle0 += Math.PI * 2; + } + else if (!clockwise && angle0 > angle1) { + angle1 += Math.PI * 2; + } + var startAngle = angle0; + var angleDiff = angle1 - angle0; + var absAngleDiff = Math.abs(angleDiff); + /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND) + { + const r1x = cx - nxtPx; + const r1y = cy - nxtPy; + + if (r1x === 0) + { + if (r1y > 0) + { + angleDiff = -angleDiff; + } + } + else if (r1x >= -GRAPHICS_CURVES.epsilon) + { + angleDiff = -angleDiff; + } + }*/ + var radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y)); + var segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1; + var angleInc = angleDiff / segCount; + startAngle += angleInc; + if (clockwise) { + verts.push(cx, cy); + verts.push(sx, sy); + for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { + verts.push(cx, cy); + verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); + } + verts.push(cx, cy); + verts.push(ex, ey); + } + else { + verts.push(sx, sy); + verts.push(cx, cy); + for (var i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) { + verts.push(cx + ((Math.sin(angle) * radius)), cy + ((Math.cos(angle) * radius))); + verts.push(cx, cy); + } + verts.push(ex, ey); + verts.push(cx, cy); + } + return segCount * 2; + } /** * Builds a line to draw using the polygon method. * @@ -35172,14 +32222,11 @@ var PIXI = (function (exports) { * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output */ - function buildNonNativeLine(graphicsData, graphicsGeometry) - { + function buildNonNativeLine(graphicsData, graphicsGeometry) { var shape = graphicsData.shape; var points = graphicsData.points || shape.points.slice(); var eps = graphicsGeometry.closePointEps; - - if (points.length === 0) - { + if (points.length === 0) { return; } // if the line width is an odd number add 0.5 to align to a whole pixel @@ -35191,193 +32238,187 @@ var PIXI = (function (exports) { // points[i] += 0.5; // } // } - var style = graphicsData.lineStyle; - // get first and last point.. figure out the middle! var firstPoint = new Point(points[0], points[1]); var lastPoint = new Point(points[points.length - 2], points[points.length - 1]); var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; var closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps && Math.abs(firstPoint.y - lastPoint.y) < eps; - // if the first point is the last point - gonna have issues :) - if (closedShape) - { + if (closedShape) { // need to clone as we are going to slightly modify the shape.. points = points.slice(); - - if (closedPath) - { + if (closedPath) { points.pop(); points.pop(); lastPoint.set(points[points.length - 2], points[points.length - 1]); } - - var midPointX = lastPoint.x + ((firstPoint.x - lastPoint.x) * 0.5); - var midPointY = lastPoint.y + ((firstPoint.y - lastPoint.y) * 0.5); - + var midPointX = (firstPoint.x + lastPoint.x) * 0.5; + var midPointY = (lastPoint.y + firstPoint.y) * 0.5; points.unshift(midPointX, midPointY); points.push(midPointX, midPointY); } - var verts = graphicsGeometry.points; var length = points.length / 2; var indexCount = points.length; var indexStart = verts.length / 2; - - // DRAW the Line + // Max. inner and outer width var width = style.width / 2; - - // sort color - var p1x = points[0]; - var p1y = points[1]; - var p2x = points[2]; - var p2y = points[3]; - var p3x = 0; - var p3y = 0; - - var perpx = -(p1y - p2y); - var perpy = p1x - p2x; - var perp2x = 0; - var perp2y = 0; - var perp3x = 0; - var perp3y = 0; - + var widthSquared = width * width; + var miterLimitSquared = style.miterLimit * style.miterLimit; + /* Line segments of interest where (x1,y1) forms the corner. */ + var x0 = points[0]; + var y0 = points[1]; + var x1 = points[2]; + var y1 = points[3]; + var x2 = 0; + var y2 = 0; + /* perp[?](x|y) = the line normal with magnitude lineWidth. */ + var perpx = -(y0 - y1); + var perpy = x0 - x1; + var perp1x = 0; + var perp1y = 0; var dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); - perpx /= dist; perpy /= dist; perpx *= width; perpy *= width; - - var ratio = style.alignment;// 0.5; - var r1 = (1 - ratio) * 2; - var r2 = ratio * 2; - - // start - verts.push( - p1x - (perpx * r1), - p1y - (perpy * r1)); - - verts.push( - p1x + (perpx * r2), - p1y + (perpy * r2)); - - for (var i = 1; i < length - 1; ++i) - { - p1x = points[(i - 1) * 2]; - p1y = points[((i - 1) * 2) + 1]; - - p2x = points[i * 2]; - p2y = points[(i * 2) + 1]; - - p3x = points[(i + 1) * 2]; - p3y = points[((i + 1) * 2) + 1]; - - perpx = -(p1y - p2y); - perpy = p1x - p2x; - + var ratio = style.alignment; // 0.5; + var innerWeight = (1 - ratio) * 2; + var outerWeight = ratio * 2; + if (!closedShape) { + if (style.cap === exports.LINE_CAP.ROUND) { + indexCount += round(x0 - (perpx * (innerWeight - outerWeight) * 0.5), y0 - (perpy * (innerWeight - outerWeight) * 0.5), x0 - (perpx * innerWeight), y0 - (perpy * innerWeight), x0 + (perpx * outerWeight), y0 + (perpy * outerWeight), verts, true) + 2; + } + else if (style.cap === exports.LINE_CAP.SQUARE) { + indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts); + } + } + // Push first point (below & above vertices) + verts.push(x0 - (perpx * innerWeight), y0 - (perpy * innerWeight)); + verts.push(x0 + (perpx * outerWeight), y0 + (perpy * outerWeight)); + for (var i = 1; i < length - 1; ++i) { + x0 = points[(i - 1) * 2]; + y0 = points[((i - 1) * 2) + 1]; + x1 = points[i * 2]; + y1 = points[(i * 2) + 1]; + x2 = points[(i + 1) * 2]; + y2 = points[((i + 1) * 2) + 1]; + perpx = -(y0 - y1); + perpy = x0 - x1; dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); perpx /= dist; perpy /= dist; perpx *= width; perpy *= width; - - perp2x = -(p2y - p3y); - perp2y = p2x - p3x; - - dist = Math.sqrt((perp2x * perp2x) + (perp2y * perp2y)); - perp2x /= dist; - perp2y /= dist; - perp2x *= width; - perp2y *= width; - - var a1 = (-perpy + p1y) - (-perpy + p2y); - var b1 = (-perpx + p2x) - (-perpx + p1x); - var c1 = ((-perpx + p1x) * (-perpy + p2y)) - ((-perpx + p2x) * (-perpy + p1y)); - var a2 = (-perp2y + p3y) - (-perp2y + p2y); - var b2 = (-perp2x + p2x) - (-perp2x + p3x); - var c2 = ((-perp2x + p3x) * (-perp2y + p2y)) - ((-perp2x + p2x) * (-perp2y + p3y)); - - var denom = (a1 * b2) - (a2 * b1); - - if (Math.abs(denom) < 0.1) - { - denom += 10.1; - verts.push( - p2x - (perpx * r1), - p2y - (perpy * r1)); - - verts.push( - p2x + (perpx * r2), - p2y + (perpy * r2)); - + perp1x = -(y1 - y2); + perp1y = x1 - x2; + dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y)); + perp1x /= dist; + perp1y /= dist; + perp1x *= width; + perp1y *= width; + /* d[x|y](0|1) = the component displacment between points p(0,1|1,2) */ + var dx0 = x1 - x0; + var dy0 = y0 - y1; + var dx1 = x1 - x2; + var dy1 = y2 - y1; + /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */ + var cross = (dy0 * dx1) - (dy1 * dx0); + var clockwise = (cross < 0); + /* Going nearly straight? */ + if (Math.abs(cross) < 0.1) { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); continue; } - - var px = ((b1 * c2) - (b2 * c1)) / denom; - var py = ((a2 * c1) - (a1 * c2)) / denom; - var pdist = ((px - p2x) * (px - p2x)) + ((py - p2y) * (py - p2y)); - - if (pdist > (196 * width * width)) - { - perp3x = perpx - perp2x; - perp3y = perpy - perp2y; - - dist = Math.sqrt((perp3x * perp3x) + (perp3y * perp3y)); - perp3x /= dist; - perp3y /= dist; - perp3x *= width; - perp3y *= width; - - verts.push(p2x - (perp3x * r1), p2y - (perp3y * r1)); - - verts.push(p2x + (perp3x * r2), p2y + (perp3y * r2)); - - verts.push(p2x - (perp3x * r2 * r1), p2y - (perp3y * r1)); - - indexCount++; + /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */ + var c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0)); + var c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2)); + var px = ((dx0 * c2) - (dx1 * c1)) / cross; + var py = ((dy1 * c1) - (dy0 * c2)) / cross; + var pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1)); + /* Inner miter point */ + var imx = x1 + ((px - x1) * innerWeight); + var imy = y1 + ((py - y1) * innerWeight); + /* Outer miter point */ + var omx = x1 - ((px - x1) * outerWeight); + var omy = y1 - ((py - y1) * outerWeight); + if (style.join === exports.LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) { + if (clockwise) /* rotating at inner angle */ { + verts.push(imx, imy); // inner miter point + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex + verts.push(imx, imy); // inner miter point + verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex + } + else /* rotating at outer angle */ { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex + verts.push(omx, omy); // outer miter point + verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's outer vertex + verts.push(omx, omy); // outer miter point + } + indexCount += 2; } - else - { - verts.push(p2x + ((px - p2x) * r1), p2y + ((py - p2y) * r1)); - - verts.push(p2x - ((px - p2x) * r2), p2y - ((py - p2y) * r2)); + else if (style.join === exports.LINE_JOIN.ROUND) { + if (clockwise) /* arc is outside */ { + verts.push(imx, imy); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); + indexCount += round(x1, y1, x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight), verts, true) + 4; + verts.push(imx, imy); + verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); + } + else /* arc is inside */ { + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(omx, omy); + indexCount += round(x1, y1, x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight), verts, false) + 4; + verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); + verts.push(omx, omy); + } + } + else { + verts.push(imx, imy); + verts.push(omx, omy); } } - - p1x = points[(length - 2) * 2]; - p1y = points[((length - 2) * 2) + 1]; - - p2x = points[(length - 1) * 2]; - p2y = points[((length - 1) * 2) + 1]; - - perpx = -(p1y - p2y); - perpy = p1x - p2x; - + x0 = points[(length - 2) * 2]; + y0 = points[((length - 2) * 2) + 1]; + x1 = points[(length - 1) * 2]; + y1 = points[((length - 1) * 2) + 1]; + perpx = -(y0 - y1); + perpy = x0 - x1; dist = Math.sqrt((perpx * perpx) + (perpy * perpy)); perpx /= dist; perpy /= dist; perpx *= width; perpy *= width; - - verts.push(p2x - (perpx * r1), p2y - (perpy * r1)); - - verts.push(p2x + (perpx * r2), p2y + (perpy * r2)); - + verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); + verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); + if (!closedShape) { + if (style.cap === exports.LINE_CAP.ROUND) { + indexCount += round(x1 - (perpx * (innerWeight - outerWeight) * 0.5), y1 - (perpy * (innerWeight - outerWeight) * 0.5), x1 - (perpx * innerWeight), y1 - (perpy * innerWeight), x1 + (perpx * outerWeight), y1 + (perpy * outerWeight), verts, false) + 2; + } + else if (style.cap === exports.LINE_CAP.SQUARE) { + indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts); + } + } var indices = graphicsGeometry.indices; - + var eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon; // indices.push(indexStart); - - for (var i$1 = 0; i$1 < indexCount - 2; ++i$1) - { - indices.push(indexStart, indexStart + 1, indexStart + 2); - - indexStart++; + for (var i = indexStart; i < indexCount + indexStart - 2; ++i) { + x0 = verts[(i * 2)]; + y0 = verts[(i * 2) + 1]; + x1 = verts[(i + 1) * 2]; + y1 = verts[((i + 1) * 2) + 1]; + x2 = verts[(i + 2) * 2]; + y2 = verts[((i + 2) * 2) + 1]; + /* Skip zero area triangles */ + if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2) { + continue; + } + indices.push(i, i + 1, i + 2); } } - /** * Builds a line to draw using the gl.drawArrays(gl.LINES) method * @@ -35388,154 +32429,45 @@ var PIXI = (function (exports) { * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output */ - function buildNativeLine(graphicsData, graphicsGeometry) - { + function buildNativeLine(graphicsData, graphicsGeometry) { var i = 0; - var shape = graphicsData.shape; var points = graphicsData.points || shape.points; var closedShape = shape.type !== exports.SHAPES.POLY || shape.closeStroke; - - if (points.length === 0) { return; } - + if (points.length === 0) + { return; } var verts = graphicsGeometry.points; var indices = graphicsGeometry.indices; var length = points.length / 2; - var startIndex = verts.length / 2; var currentIndex = startIndex; - verts.push(points[0], points[1]); - - for (i = 1; i < length; i++) - { + for (i = 1; i < length; i++) { verts.push(points[i * 2], points[(i * 2) + 1]); indices.push(currentIndex, currentIndex + 1); - currentIndex++; } - - if (closedShape) - { + if (closedShape) { indices.push(currentIndex, startIndex); } } - /** - * Builds a complex polygon to draw + * Builds a line to draw * * Ignored from docs since it is not directly exposed. * * @ignore * @private - * @param {PIXI.Graphics} graphicsData - The graphics object containing all the necessary properties - * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape + * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties + * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output */ - function buildComplexPoly(graphicsData, webGLData) - { - // TODO - no need to copy this as it gets turned into a Float32Array anyways.. - var points = graphicsData.points.slice(); - - if (points.length < 6) - { - return; + function buildLine(graphicsData, graphicsGeometry) { + if (graphicsData.lineStyle.native) { + buildNativeLine(graphicsData, graphicsGeometry); } - - // get first and last point.. figure out the middle! - var indices = webGLData.indices; - - webGLData.points = points; - webGLData.alpha = graphicsData.fillAlpha; - webGLData.color = hex2rgb(graphicsData.fillColor); - - // calculate the bounds.. - var minX = Infinity; - var maxX = -Infinity; - - var minY = Infinity; - var maxY = -Infinity; - - var x = 0; - var y = 0; - - // get size.. - for (var i = 0; i < points.length; i += 2) - { - x = points[i]; - y = points[i + 1]; - - minX = x < minX ? x : minX; - maxX = x > maxX ? x : maxX; - - minY = y < minY ? y : minY; - maxY = y > maxY ? y : maxY; + else { + buildNonNativeLine(graphicsData, graphicsGeometry); } - - // add a quad to the end cos there is no point making another buffer! - points.push(minX, minY, - maxX, minY, - maxX, maxY, - minX, maxY); - - // push a quad onto the end.. - - // TODO - this ain't needed! - var length = points.length / 2; - - for (var i$1 = 0; i$1 < length; i$1++) - { - indices.push(i$1); - } - } - - /** - * Calculate the points for a bezier curve and then draws it. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @param {number} fromX - Starting point x - * @param {number} fromY - Starting point y - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number} n - Number of segments approximating the bezier curve - * @param {number[]} [path=[]] - Path array to push points into - * @return {number[]} Array of points of the curve - */ - function bezierCurveTo(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY, n, path) - { - if ( path === void 0 ) { path = []; } - - var dt = 0; - var dt2 = 0; - var dt3 = 0; - var t2 = 0; - var t3 = 0; - - path.push(fromX, fromY); - - for (var i = 1, j = 0; i <= n; ++i) - { - j = i / n; - - dt = (1 - j); - dt2 = dt * dt; - dt3 = dt2 * dt; - - t2 = j * j; - t3 = t2 * j; - - path.push( - (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), - (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY) - ); - } - - return path; } /** @@ -35543,7 +32475,7 @@ var PIXI = (function (exports) { * * @class * @extends PIXI.Polygon - * @memberof PIXI + * @memberof PIXI.graphicsUtils * @param {number} x - Center X position of the star * @param {number} y - Center Y position of the star * @param {number} points - The number of points of the star, must be > 1 @@ -35552,34 +32484,24 @@ var PIXI = (function (exports) { * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - var Star = /*@__PURE__*/(function (Polygon) { - function Star(x, y, points, radius, innerRadius, rotation) - { + var Star = /** @class */ (function (_super) { + __extends$5(Star, _super); + function Star(x, y, points, radius, innerRadius, rotation) { + if (rotation === void 0) { rotation = 0; } + var _this = this; innerRadius = innerRadius || radius / 2; - var startAngle = (-1 * Math.PI / 2) + rotation; var len = points * 2; var delta = PI_2 / len; var polygon = []; - - for (var i = 0; i < len; i++) - { + for (var i = 0; i < len; i++) { var r = i % 2 ? innerRadius : radius; var angle = (i * delta) + startAngle; - - polygon.push( - x + (r * Math.cos(angle)), - y + (r * Math.sin(angle)) - ); + polygon.push(x + (r * Math.cos(angle)), y + (r * Math.sin(angle))); } - - Polygon.call(this, polygon); + _this = _super.call(this, polygon) || this; + return _this; } - - if ( Polygon ) { Star.__proto__ = Polygon; } - Star.prototype = Object.create( Polygon && Polygon.prototype ); - Star.prototype.constructor = Star; - return Star; }(Polygon)); @@ -35588,345 +32510,333 @@ var PIXI = (function (exports) { * @class * @private */ - var ArcUtils = function ArcUtils () {}; - - ArcUtils.curveTo = function curveTo (x1, y1, x2, y2, radius, points) - { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - - var a1 = fromY - y1; - var b1 = fromX - x1; - var a2 = y2 - y1; - var b2 = x2 - x1; - var mm = Math.abs((a1 * b2) - (b1 * a2)); - - if (mm < 1.0e-8 || radius === 0) - { - if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) - { - points.push(x1, y1); + var ArcUtils = /** @class */ (function () { + function ArcUtils() { + } + /** + * The arcTo() method creates an arc/curve between two tangents on the canvas. + * + * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google! + * + * @private + * @param {number} x1 - The x-coordinate of the beginning of the arc + * @param {number} y1 - The y-coordinate of the beginning of the arc + * @param {number} x2 - The x-coordinate of the end of the arc + * @param {number} y2 - The y-coordinate of the end of the arc + * @param {number} radius - The radius of the arc + * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`. + */ + ArcUtils.curveTo = function (x1, y1, x2, y2, radius, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var a1 = fromY - y1; + var b1 = fromX - x1; + var a2 = y2 - y1; + var b2 = x2 - x1; + var mm = Math.abs((a1 * b2) - (b1 * a2)); + if (mm < 1.0e-8 || radius === 0) { + if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1) { + points.push(x1, y1); + } + return null; } - - return null; - } - - var dd = (a1 * a1) + (b1 * b1); - var cc = (a2 * a2) + (b2 * b2); - var tt = (a1 * a2) + (b1 * b2); - var k1 = radius * Math.sqrt(dd) / mm; - var k2 = radius * Math.sqrt(cc) / mm; - var j1 = k1 * tt / dd; - var j2 = k2 * tt / cc; - var cx = (k1 * b2) + (k2 * b1); - var cy = (k1 * a2) + (k2 * a1); - var px = b1 * (k2 + j1); - var py = a1 * (k2 + j1); - var qx = b2 * (k1 + j2); - var qy = a2 * (k1 + j2); - var startAngle = Math.atan2(py - cy, px - cx); - var endAngle = Math.atan2(qy - cy, qx - cx); - - return { - cx: (cx + x1), - cy: (cy + y1), - radius: radius, - startAngle: startAngle, - endAngle: endAngle, - anticlockwise: (b1 * a2 > b2 * a1), + var dd = (a1 * a1) + (b1 * b1); + var cc = (a2 * a2) + (b2 * b2); + var tt = (a1 * a2) + (b1 * b2); + var k1 = radius * Math.sqrt(dd) / mm; + var k2 = radius * Math.sqrt(cc) / mm; + var j1 = k1 * tt / dd; + var j2 = k2 * tt / cc; + var cx = (k1 * b2) + (k2 * b1); + var cy = (k1 * a2) + (k2 * a1); + var px = b1 * (k2 + j1); + var py = a1 * (k2 + j1); + var qx = b2 * (k1 + j2); + var qy = a2 * (k1 + j2); + var startAngle = Math.atan2(py - cy, px - cx); + var endAngle = Math.atan2(qy - cy, qx - cx); + return { + cx: (cx + x1), + cy: (cy + y1), + radius: radius, + startAngle: startAngle, + endAngle: endAngle, + anticlockwise: (b1 * a2 > b2 * a1), + }; }; - }; - - /** - * The arc method creates an arc/curve (used to create circles, or parts of circles). - * - * @private - * @param {number} startX - Start x location of arc - * @param {number} startY - Start y location of arc - * @param {number} cx - The x-coordinate of the center of the circle - * @param {number} cy - The y-coordinate of the center of the circle - * @param {number} radius - The radius of the circle - * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position - * of the arc's circle) - * @param {number} endAngle - The ending angle, in radians - * @param {boolean} anticlockwise - Specifies whether the drawing should be - * counter-clockwise or clockwise. False is default, and indicates clockwise, while true - * indicates counter-clockwise. - * @param {number} n - Number of segments - * @param {number[]} points - Collection of points to add to - */ - ArcUtils.arc = function arc (startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points) - { - var sweep = endAngle - startAngle; - var n = GRAPHICS_CURVES._segmentsCount( - Math.abs(sweep) * radius, - Math.ceil(Math.abs(sweep) / PI_2) * 40 - ); - - var theta = (sweep) / (n * 2); - var theta2 = theta * 2; - var cTheta = Math.cos(theta); - var sTheta = Math.sin(theta); - var segMinus = n - 1; - var remainder = (segMinus % 1) / segMinus; - - for (var i = 0; i <= segMinus; ++i) - { - var real = i + (remainder * i); - var angle = ((theta) + startAngle + (theta2 * real)); - var c = Math.cos(angle); - var s = -Math.sin(angle); - - points.push( - (((cTheta * c) + (sTheta * s)) * radius) + cx, - (((cTheta * -s) + (sTheta * c)) * radius) + cy - ); - } - }; + /* eslint-disable max-len */ + /** + * The arc method creates an arc/curve (used to create circles, or parts of circles). + * + * @private + * @param {number} startX - Start x location of arc + * @param {number} startY - Start y location of arc + * @param {number} cx - The x-coordinate of the center of the circle + * @param {number} cy - The y-coordinate of the center of the circle + * @param {number} radius - The radius of the circle + * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position + * of the arc's circle) + * @param {number} endAngle - The ending angle, in radians + * @param {boolean} anticlockwise - Specifies whether the drawing should be + * counter-clockwise or clockwise. False is default, and indicates clockwise, while true + * indicates counter-clockwise. + * @param {number[]} points - Collection of points to add to + */ + ArcUtils.arc = function (_startX, _startY, cx, cy, radius, startAngle, endAngle, _anticlockwise, points) { + var sweep = endAngle - startAngle; + var n = GRAPHICS_CURVES._segmentsCount(Math.abs(sweep) * radius, Math.ceil(Math.abs(sweep) / PI_2) * 40); + var theta = (sweep) / (n * 2); + var theta2 = theta * 2; + var cTheta = Math.cos(theta); + var sTheta = Math.sin(theta); + var segMinus = n - 1; + var remainder = (segMinus % 1) / segMinus; + for (var i = 0; i <= segMinus; ++i) { + var real = i + (remainder * i); + var angle = ((theta) + startAngle + (theta2 * real)); + var c = Math.cos(angle); + var s = -Math.sin(angle); + points.push((((cTheta * c) + (sTheta * s)) * radius) + cx, (((cTheta * -s) + (sTheta * c)) * radius) + cy); + } + }; + return ArcUtils; + }()); /** * Utilities for bezier curves * @class * @private */ - var BezierUtils = function BezierUtils () {}; - - BezierUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) - { - var n = 10; - var result = 0.0; - var t = 0.0; - var t2 = 0.0; - var t3 = 0.0; - var nt = 0.0; - var nt2 = 0.0; - var nt3 = 0.0; - var x = 0.0; - var y = 0.0; - var dx = 0.0; - var dy = 0.0; - var prevX = fromX; - var prevY = fromY; - - for (var i = 1; i <= n; ++i) - { - t = i / n; - t2 = t * t; - t3 = t2 * t; - nt = (1.0 - t); - nt2 = nt * nt; - nt3 = nt2 * nt; - - x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX); - y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY); - dx = prevX - x; - dy = prevY - y; - prevX = x; - prevY = y; - - result += Math.sqrt((dx * dx) + (dy * dy)); + var BezierUtils = /** @class */ (function () { + function BezierUtils() { } - - return result; - }; - - /** - * Calculate the points for a bezier curve and then draws it. - * - * Ignored from docs since it is not directly exposed. - * - * @ignore - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} cpX2 - Second Control point x - * @param {number} cpY2 - Second Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Path array to push points into - */ - BezierUtils.curveTo = function curveTo (cpX, cpY, cpX2, cpY2, toX, toY, points) - { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - - points.length -= 2; - - var n = GRAPHICS_CURVES._segmentsCount( - BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) - ); - - var dt = 0; - var dt2 = 0; - var dt3 = 0; - var t2 = 0; - var t3 = 0; - - points.push(fromX, fromY); - - for (var i = 1, j = 0; i <= n; ++i) - { - j = i / n; - - dt = (1 - j); - dt2 = dt * dt; - dt3 = dt2 * dt; - - t2 = j * j; - t3 = t2 * j; - - points.push( - (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), - (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY) - ); - } - }; + /** + * Calculate length of bezier curve. + * Analytical solution is impossible, since it involves an integral that does not integrate in general. + * Therefore numerical solution is used. + * + * @private + * @param {number} fromX - Starting point x + * @param {number} fromY - Starting point y + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @return {number} Length of bezier curve + */ + BezierUtils.curveLength = function (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) { + var n = 10; + var result = 0.0; + var t = 0.0; + var t2 = 0.0; + var t3 = 0.0; + var nt = 0.0; + var nt2 = 0.0; + var nt3 = 0.0; + var x = 0.0; + var y = 0.0; + var dx = 0.0; + var dy = 0.0; + var prevX = fromX; + var prevY = fromY; + for (var i = 1; i <= n; ++i) { + t = i / n; + t2 = t * t; + t3 = t2 * t; + nt = (1.0 - t); + nt2 = nt * nt; + nt3 = nt2 * nt; + x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX); + y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY); + dx = prevX - x; + dy = prevY - y; + prevX = x; + prevY = y; + result += Math.sqrt((dx * dx) + (dy * dy)); + } + return result; + }; + /** + * Calculate the points for a bezier curve and then draws it. + * + * Ignored from docs since it is not directly exposed. + * + * @ignore + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} cpX2 - Second Control point x + * @param {number} cpY2 - Second Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} points - Path array to push points into + */ + BezierUtils.curveTo = function (cpX, cpY, cpX2, cpY2, toX, toY, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + points.length -= 2; + var n = GRAPHICS_CURVES._segmentsCount(BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)); + var dt = 0; + var dt2 = 0; + var dt3 = 0; + var t2 = 0; + var t3 = 0; + points.push(fromX, fromY); + for (var i = 1, j = 0; i <= n; ++i) { + j = i / n; + dt = (1 - j); + dt2 = dt * dt; + dt3 = dt2 * dt; + t2 = j * j; + t3 = t2 * j; + points.push((dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX), (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)); + } + }; + return BezierUtils; + }()); /** * Utilities for quadratic curves * @class * @private */ - var QuadraticUtils = function QuadraticUtils () {}; - - QuadraticUtils.curveLength = function curveLength (fromX, fromY, cpX, cpY, toX, toY) - { - var ax = fromX - (2.0 * cpX) + toX; - var ay = fromY - (2.0 * cpY) + toY; - var bx = (2.0 * cpX) - (2.0 * fromX); - var by = (2.0 * cpY) - (2.0 * fromY); - var a = 4.0 * ((ax * ax) + (ay * ay)); - var b = 4.0 * ((ax * bx) + (ay * by)); - var c = (bx * bx) + (by * by); - - var s = 2.0 * Math.sqrt(a + b + c); - var a2 = Math.sqrt(a); - var a32 = 2.0 * a * a2; - var c2 = 2.0 * Math.sqrt(c); - var ba = b / a2; - - return ( - (a32 * s) - + (a2 * b * (s - c2)) - + ( - ((4.0 * c * a) - (b * b)) - * Math.log(((2.0 * a2) + ba + s) / (ba + c2)) - ) - ) / (4.0 * a32); - }; - - /** - * Calculate the points for a quadratic bezier curve and then draws it. - * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c - * - * @private - * @param {number} cpX - Control point x - * @param {number} cpY - Control point y - * @param {number} toX - Destination point x - * @param {number} toY - Destination point y - * @param {number[]} points - Points to add segments to. - */ - QuadraticUtils.curveTo = function curveTo (cpX, cpY, toX, toY, points) - { - var fromX = points[points.length - 2]; - var fromY = points[points.length - 1]; - - var n = GRAPHICS_CURVES._segmentsCount( - QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY) - ); - - var xa = 0; - var ya = 0; - - for (var i = 1; i <= n; ++i) - { - var j = i / n; - - xa = fromX + ((cpX - fromX) * j); - ya = fromY + ((cpY - fromY) * j); - - points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), - ya + (((cpY + ((toY - cpY) * j)) - ya) * j)); + var QuadraticUtils = /** @class */ (function () { + function QuadraticUtils() { } - }; + /** + * Calculate length of quadratic curve + * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/} + * for the detailed explanation of math behind this. + * + * @private + * @param {number} fromX - x-coordinate of curve start point + * @param {number} fromY - y-coordinate of curve start point + * @param {number} cpX - x-coordinate of curve control point + * @param {number} cpY - y-coordinate of curve control point + * @param {number} toX - x-coordinate of curve end point + * @param {number} toY - y-coordinate of curve end point + * @return {number} Length of quadratic curve + */ + QuadraticUtils.curveLength = function (fromX, fromY, cpX, cpY, toX, toY) { + var ax = fromX - (2.0 * cpX) + toX; + var ay = fromY - (2.0 * cpY) + toY; + var bx = (2.0 * cpX) - (2.0 * fromX); + var by = (2.0 * cpY) - (2.0 * fromY); + var a = 4.0 * ((ax * ax) + (ay * ay)); + var b = 4.0 * ((ax * bx) + (ay * by)); + var c = (bx * bx) + (by * by); + var s = 2.0 * Math.sqrt(a + b + c); + var a2 = Math.sqrt(a); + var a32 = 2.0 * a * a2; + var c2 = 2.0 * Math.sqrt(c); + var ba = b / a2; + return ((a32 * s) + + (a2 * b * (s - c2)) + + (((4.0 * c * a) - (b * b)) + * Math.log(((2.0 * a2) + ba + s) / (ba + c2)))) / (4.0 * a32); + }; + /** + * Calculate the points for a quadratic bezier curve and then draws it. + * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c + * + * @private + * @param {number} cpX - Control point x + * @param {number} cpY - Control point y + * @param {number} toX - Destination point x + * @param {number} toY - Destination point y + * @param {number[]} points - Points to add segments to. + */ + QuadraticUtils.curveTo = function (cpX, cpY, toX, toY, points) { + var fromX = points[points.length - 2]; + var fromY = points[points.length - 1]; + var n = GRAPHICS_CURVES._segmentsCount(QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)); + var xa = 0; + var ya = 0; + for (var i = 1; i <= n; ++i) { + var j = i / n; + xa = fromX + ((cpX - fromX) * j); + ya = fromY + ((cpY - fromY) * j); + points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j), ya + (((cpY + ((toY - cpY) * j)) - ya) * j)); + } + }; + return QuadraticUtils; + }()); /** * A structure to hold interim batch objects for Graphics. * @class * @memberof PIXI.graphicsUtils */ - var BatchPart = function BatchPart() - { - this.reset(); - }; - - /** - * Begin batch part - * - * @param {PIXI.FillStyle | PIXI.LineStyle} style - * @param {number} startIndex - * @param {number} attribStart - */ - BatchPart.prototype.begin = function begin (style, startIndex, attribStart) - { - this.reset(); - this.style = style; - this.start = startIndex; - this.attribStart = attribStart; - }; - - /** - * End batch part - * - * @param {number} endIndex - * @param {number} endAttrib - */ - BatchPart.prototype.end = function end (endIndex, endAttrib) - { - this.attribSize = endAttrib - this.attribStart; - this.size = endIndex - this.start; - }; - - BatchPart.prototype.reset = function reset () - { - this.style = null; - this.size = 0; - this.start = 0; - this.attribStart = 0; - this.attribSize = 0; - }; + var BatchPart = /** @class */ (function () { + function BatchPart() { + this.reset(); + } + /** + * Begin batch part + * + * @param {PIXI.FillStyle | PIXI.LineStyle} style + * @param {number} startIndex + * @param {number} attribStart + */ + BatchPart.prototype.begin = function (style, startIndex, attribStart) { + this.reset(); + this.style = style; + this.start = startIndex; + this.attribStart = attribStart; + }; + /** + * End batch part + * + * @param {number} endIndex + * @param {number} endAttrib + */ + BatchPart.prototype.end = function (endIndex, endAttrib) { + this.attribSize = endAttrib - this.attribStart; + this.size = endIndex - this.start; + }; + BatchPart.prototype.reset = function () { + this.style = null; + this.size = 0; + this.start = 0; + this.attribStart = 0; + this.attribSize = 0; + }; + return BatchPart; + }()); /** * Generalized convenience utilities for Graphics. * - * @namespace PIXI.graphicsUtils + * @namespace graphicsUtils + * @memberof PIXI */ - + var _a; /** * Map of fill commands for each shape type. * * @memberof PIXI.graphicsUtils - * @member {Object} + * @member {Object} FILL_COMMANDS */ - var FILL_COMMANDS = {}; - FILL_COMMANDS[exports.SHAPES.POLY] = buildPoly; - FILL_COMMANDS[exports.SHAPES.CIRC] = buildCircle; - FILL_COMMANDS[exports.SHAPES.ELIP] = buildCircle; - FILL_COMMANDS[exports.SHAPES.RECT] = buildRectangle; - FILL_COMMANDS[exports.SHAPES.RREC] = buildRoundedRectangle; - + var FILL_COMMANDS = (_a = {}, + _a[exports.SHAPES.POLY] = buildPoly, + _a[exports.SHAPES.CIRC] = buildCircle, + _a[exports.SHAPES.ELIP] = buildCircle, + _a[exports.SHAPES.RECT] = buildRectangle, + _a[exports.SHAPES.RREC] = buildRoundedRectangle, + _a); /** * Batch pool, stores unused batches for preventing allocations. * * @memberof PIXI.graphicsUtils - * @type {Array} + * @member {Array} BATCH_POOL */ var BATCH_POOL = []; - /** * Draw call pool, stores unused draw calls for preventing allocations. * * @memberof PIXI.graphicsUtils - * @type {Array} + * @member {Array} DRAW_CALL_POOL */ var DRAW_CALL_POOL = []; @@ -35939,8 +32849,6 @@ var PIXI = (function (exports) { BATCH_POOL: BATCH_POOL, DRAW_CALL_POOL: DRAW_CALL_POOL, buildLine: buildLine, - buildComplexPoly: buildComplexPoly, - bezierCurveTo: bezierCurveTo, Star: Star, ArcUtils: ArcUtils, BezierUtils: BezierUtils, @@ -35954,87 +32862,80 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var GraphicsData = function GraphicsData(shape, fillStyle, lineStyle, matrix) - { - if ( fillStyle === void 0 ) { fillStyle = null; } - if ( lineStyle === void 0 ) { lineStyle = null; } - if ( matrix === void 0 ) { matrix = null; } - + var GraphicsData = /** @class */ (function () { /** - * The shape object to draw. - * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} + * + * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw. + * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw + * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw + * @param {PIXI.Matrix} [matrix] - Transform matrix */ - this.shape = shape; - + function GraphicsData(shape, fillStyle, lineStyle, matrix) { + if (fillStyle === void 0) { fillStyle = null; } + if (lineStyle === void 0) { lineStyle = null; } + if (matrix === void 0) { matrix = null; } + /** + * The shape object to draw. + * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} + */ + this.shape = shape; + /** + * The style of the line. + * @member {PIXI.LineStyle} + */ + this.lineStyle = lineStyle; + /** + * The style of the fill. + * @member {PIXI.FillStyle} + */ + this.fillStyle = fillStyle; + /** + * The transform matrix. + * @member {PIXI.Matrix} + */ + this.matrix = matrix; + /** + * The type of the shape, see the Const.Shapes file for all the existing types, + * @member {number} + */ + this.type = shape.type; + /** + * The collection of points. + * @member {number[]} + */ + this.points = []; + /** + * The collection of holes. + * @member {PIXI.GraphicsData[]} + */ + this.holes = []; + } /** - * The style of the line. - * @member {PIXI.LineStyle} + * Creates a new GraphicsData object with the same values as this one. + * + * @return {PIXI.GraphicsData} Cloned GraphicsData object */ - this.lineStyle = lineStyle; - + GraphicsData.prototype.clone = function () { + return new GraphicsData(this.shape, this.fillStyle, this.lineStyle, this.matrix); + }; /** - * The style of the fill. - * @member {PIXI.FillStyle} + * Destroys the Graphics data. + * */ - this.fillStyle = fillStyle; - - /** - * The transform matrix. - * @member {PIXI.Matrix} - */ - this.matrix = matrix; - - /** - * The type of the shape, see the Const.Shapes file for all the existing types, - * @member {number} - */ - this.type = shape.type; - - /** - * The collection of points. - * @member {number[]} - */ - this.points = []; - - /** - * The collection of holes. - * @member {PIXI.GraphicsData[]} - */ - this.holes = []; - }; - - /** - * Creates a new GraphicsData object with the same values as this one. - * - * @return {PIXI.GraphicsData} Cloned GraphicsData object - */ - GraphicsData.prototype.clone = function clone () - { - return new GraphicsData( - this.shape, - this.fillStyle, - this.lineStyle, - this.matrix - ); - }; - - /** - * Destroys the Graphics data. - */ - GraphicsData.prototype.destroy = function destroy () - { - this.shape = null; - this.holes.length = 0; - this.holes = null; - this.points.length = 0; - this.points = null; - this.lineStyle = null; - this.fillStyle = null; - }; + GraphicsData.prototype.destroy = function () { + this.shape = null; + this.holes.length = 0; + this.holes = null; + this.points.length = 0; + this.points = null; + this.lineStyle = null; + this.fillStyle = null; + }; + return GraphicsData; + }()); var tmpPoint = new Point(); var tmpBounds = new Bounds(); - /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and * rectangles to the display, and to color and fill them. @@ -36046,83 +32947,75 @@ var PIXI = (function (exports) { * @extends PIXI.BatchGeometry * @memberof PIXI */ - var GraphicsGeometry = /*@__PURE__*/(function (BatchGeometry) { - function GraphicsGeometry() - { - BatchGeometry.call(this); - + var GraphicsGeometry = /** @class */ (function (_super) { + __extends$5(GraphicsGeometry, _super); + function GraphicsGeometry() { + var _this = _super.call(this) || this; + _this.uvsFloat32 = null; + _this.indicesUint16 = null; /** * An array of points to draw, 2 numbers per point * * @member {number[]} * @protected */ - this.points = []; - + _this.points = []; /** * The collection of colors * * @member {number[]} * @protected */ - this.colors = []; - + _this.colors = []; /** * The UVs collection * * @member {number[]} * @protected */ - this.uvs = []; - + _this.uvs = []; /** * The indices of the vertices * * @member {number[]} * @protected */ - this.indices = []; - + _this.indices = []; /** * Reference to the texture IDs. * * @member {number[]} * @protected */ - this.textureIds = []; - + _this.textureIds = []; /** * The collection of drawn shapes. * * @member {PIXI.GraphicsData[]} * @protected */ - this.graphicsData = []; - + _this.graphicsData = []; /** * Used to detect if the graphics object has changed. * * @member {number} * @protected */ - this.dirty = 0; - + _this.dirty = 0; /** * Batches need to regenerated if the geometry is updated. * * @member {number} * @protected */ - this.batchDirty = -1; - + _this.batchDirty = -1; /** * Used to check if the cache is dirty. * * @member {number} * @protected */ - this.cacheDirty = -1; - + _this.cacheDirty = -1; /** * Used to detect if we cleared the graphicsData. * @@ -36130,16 +33023,14 @@ var PIXI = (function (exports) { * @default 0 * @protected */ - this.clearDirty = 0; - + _this.clearDirty = 0; /** * List of current draw calls drived from the batches. * * @member {object[]} * @protected */ - this.drawCalls = []; - + _this.drawCalls = []; /** * Intermediate abstract format sent to batch system. * Can be converted to drawCalls or to batchable objects. @@ -36147,131 +33038,103 @@ var PIXI = (function (exports) { * @member {PIXI.graphicsUtils.BatchPart[]} * @protected */ - this.batches = []; - + _this.batches = []; /** * Index of the last batched shape in the stack of calls. * * @member {number} * @protected */ - this.shapeIndex = 0; - + _this.shapeIndex = 0; /** * Cached bounds. * * @member {PIXI.Bounds} * @protected */ - this._bounds = new Bounds(); - + _this._bounds = new Bounds(); /** * The bounds dirty flag. * * @member {number} * @protected */ - this.boundsDirty = -1; - + _this.boundsDirty = -1; /** * Padding to add to the bounds. * * @member {number} * @default 0 */ - this.boundsPadding = 0; - - this.batchable = false; - - this.indicesUint16 = null; - - this.uvsFloat32 = null; - + _this.boundsPadding = 0; + _this.batchable = false; + _this.indicesUint16 = null; + _this.uvsFloat32 = null; /** * Minimal distance between points that are considered different. * Affects line tesselation. * * @member {number} */ - this.closePointEps = 1e-4; + _this.closePointEps = 1e-4; + return _this; } - - if ( BatchGeometry ) { GraphicsGeometry.__proto__ = BatchGeometry; } - GraphicsGeometry.prototype = Object.create( BatchGeometry && BatchGeometry.prototype ); - GraphicsGeometry.prototype.constructor = GraphicsGeometry; - - var prototypeAccessors = { bounds: { configurable: true } }; - - /** - * Get the current bounds of the graphic geometry. - * - * @member {PIXI.Bounds} - * @readonly - */ - prototypeAccessors.bounds.get = function () - { - if (this.boundsDirty !== this.dirty) - { - this.boundsDirty = this.dirty; - this.calculateBounds(); - } - - return this._bounds; - }; - + Object.defineProperty(GraphicsGeometry.prototype, "bounds", { + /** + * Get the current bounds of the graphic geometry. + * + * @member {PIXI.Bounds} + * @readonly + */ + get: function () { + if (this.boundsDirty !== this.dirty) { + this.boundsDirty = this.dirty; + this.calculateBounds(); + } + return this._bounds; + }, + enumerable: false, + configurable: true + }); /** * Call if you changed graphicsData manually. * Empties all batch buffers. */ - GraphicsGeometry.prototype.invalidate = function invalidate () - { + GraphicsGeometry.prototype.invalidate = function () { this.boundsDirty = -1; this.dirty++; this.batchDirty++; this.shapeIndex = 0; - this.points.length = 0; this.colors.length = 0; this.uvs.length = 0; this.indices.length = 0; this.textureIds.length = 0; - - for (var i = 0; i < this.drawCalls.length; i++) - { - this.drawCalls[i].textures.length = 0; + for (var i = 0; i < this.drawCalls.length; i++) { + this.drawCalls[i].texArray.clear(); DRAW_CALL_POOL.push(this.drawCalls[i]); } - this.drawCalls.length = 0; - - for (var i$1 = 0; i$1 < this.batches.length; i$1++) - { - var batchPart = this.batches[i$1]; - + for (var i = 0; i < this.batches.length; i++) { + var batchPart = this.batches[i]; batchPart.reset(); BATCH_POOL.push(batchPart); } - this.batches.length = 0; }; - /** * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. * * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls */ - GraphicsGeometry.prototype.clear = function clear () - { - if (this.graphicsData.length > 0) - { + GraphicsGeometry.prototype.clear = function () { + if (this.graphicsData.length > 0) { this.invalidate(); this.clearDirty++; this.graphicsData.length = 0; } - return this; }; - /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * @@ -36281,16 +33144,15 @@ var PIXI = (function (exports) { * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ - GraphicsGeometry.prototype.drawShape = function drawShape (shape, fillStyle, lineStyle, matrix) - { + GraphicsGeometry.prototype.drawShape = function (shape, fillStyle, lineStyle, matrix) { + if (fillStyle === void 0) { fillStyle = null; } + if (lineStyle === void 0) { lineStyle = null; } + if (matrix === void 0) { matrix = null; } var data = new GraphicsData(shape, fillStyle, lineStyle, matrix); - this.graphicsData.push(data); this.dirty++; - return this; }; - /** * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon. * @@ -36298,48 +33160,28 @@ var PIXI = (function (exports) { * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape. * @return {PIXI.GraphicsGeometry} Returns geometry for chaining. */ - GraphicsGeometry.prototype.drawHole = function drawHole (shape, matrix) - { - if (!this.graphicsData.length) - { + GraphicsGeometry.prototype.drawHole = function (shape, matrix) { + if (matrix === void 0) { matrix = null; } + if (!this.graphicsData.length) { return null; } - var data = new GraphicsData(shape, null, null, matrix); - var lastShape = this.graphicsData[this.graphicsData.length - 1]; - data.lineStyle = lastShape.lineStyle; - lastShape.holes.push(data); - this.dirty++; - return this; }; - /** - * Destroys the Graphics object. + * Destroys the GraphicsGeometry object. * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the texture of the child sprite - * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true - * Should it destroy the base texture of the child sprite */ - GraphicsGeometry.prototype.destroy = function destroy (options) - { - BatchGeometry.prototype.destroy.call(this, options); - + GraphicsGeometry.prototype.destroy = function () { + _super.prototype.destroy.call(this); // destroy each of the GraphicsData objects - for (var i = 0; i < this.graphicsData.length; ++i) - { + for (var i = 0; i < this.graphicsData.length; ++i) { this.graphicsData[i].destroy(); } - this.points.length = 0; this.points = null; this.colors.length = 0; @@ -36358,590 +33200,431 @@ var PIXI = (function (exports) { this.batches = null; this._bounds = null; }; - /** * Check to see if a point is contained within this geometry. * - * @param {PIXI.Point} point - Point to check if it's contained. + * @param {PIXI.IPointData} point - Point to check if it's contained. * @return {Boolean} `true` if the point is contained within geometry. */ - GraphicsGeometry.prototype.containsPoint = function containsPoint (point) - { + GraphicsGeometry.prototype.containsPoint = function (point) { var graphicsData = this.graphicsData; - - for (var i = 0; i < graphicsData.length; ++i) - { + for (var i = 0; i < graphicsData.length; ++i) { var data = graphicsData[i]; - - if (!data.fillStyle.visible) - { + if (!data.fillStyle.visible) { continue; } - // only deal with fills.. - if (data.shape) - { - if (data.matrix) - { + if (data.shape) { + if (data.matrix) { data.matrix.applyInverse(point, tmpPoint); } - else - { + else { tmpPoint.copyFrom(point); } - - if (data.shape.contains(tmpPoint.x, tmpPoint.y)) - { + if (data.shape.contains(tmpPoint.x, tmpPoint.y)) { var hitHole = false; - - if (data.holes) - { - for (var i$1 = 0; i$1 < data.holes.length; i$1++) - { - var hole = data.holes[i$1]; - - if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) - { + if (data.holes) { + for (var i_1 = 0; i_1 < data.holes.length; i_1++) { + var hole = data.holes[i_1]; + if (hole.shape.contains(tmpPoint.x, tmpPoint.y)) { hitHole = true; break; } } } - - if (!hitHole) - { + if (!hitHole) { return true; } } } } - return false; }; - /** * Generates intermediate batch data. Either gets converted to drawCalls * or used to convert to batch objects directly by the Graphics object. + * + * @param {boolean} [aloow32Indices] - Allow using 32-bit indices for preventings artefacts when more that 65535 vertices */ - GraphicsGeometry.prototype.updateBatches = function updateBatches () - { - if (!this.graphicsData.length) - { + GraphicsGeometry.prototype.updateBatches = function (allow32Indices) { + if (!this.graphicsData.length) { this.batchable = true; - return; } - - if (!this.validateBatching()) - { + if (!this.validateBatching()) { return; } - this.cacheDirty = this.dirty; - var uvs = this.uvs; var graphicsData = this.graphicsData; - var batchPart = null; - var currentStyle = null; - - if (this.batches.length > 0) - { + if (this.batches.length > 0) { batchPart = this.batches[this.batches.length - 1]; currentStyle = batchPart.style; } - - for (var i = this.shapeIndex; i < graphicsData.length; i++) - { + for (var i = this.shapeIndex; i < graphicsData.length; i++) { this.shapeIndex++; - var data = graphicsData[i]; var fillStyle = data.fillStyle; var lineStyle = data.lineStyle; var command = FILL_COMMANDS[data.type]; - // build out the shapes points.. command.build(data); - - if (data.matrix) - { + if (data.matrix) { this.transformPoints(data.points, data.matrix); } - - for (var j = 0; j < 2; j++) - { + for (var j = 0; j < 2; j++) { var style = (j === 0) ? fillStyle : lineStyle; - - if (!style.visible) { continue; } - + if (!style.visible) + { continue; } var nextTexture = style.texture.baseTexture; - var index = this.indices.length; + var index_1 = this.indices.length; var attribIndex = this.points.length / 2; - nextTexture.wrapMode = exports.WRAP_MODES.REPEAT; - - if (j === 0) - { + if (j === 0) { this.processFill(data); } - else - { + else { this.processLine(data); } - var size = (this.points.length / 2) - attribIndex; - - if (size === 0) { continue; } + if (size === 0) + { continue; } // close batch if style is different - if (batchPart && !this._compareStyles(currentStyle, style)) - { - batchPart.end(index, attribIndex); + if (batchPart && !this._compareStyles(currentStyle, style)) { + batchPart.end(index_1, attribIndex); batchPart = null; } // spawn new batch if its first batch or previous was closed - if (!batchPart) - { + if (!batchPart) { batchPart = BATCH_POOL.pop() || new BatchPart(); - batchPart.begin(style, index, attribIndex); + batchPart.begin(style, index_1, attribIndex); this.batches.push(batchPart); currentStyle = style; } - this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix); } } - - if (batchPart) - { - var index$1 = this.indices.length; - var attrib = this.points.length / 2; - - batchPart.end(index$1, attrib); + var index = this.indices.length; + var attrib = this.points.length / 2; + if (batchPart) { + batchPart.end(index, attrib); } - - if (this.batches.length === 0) - { + if (this.batches.length === 0) { // there are no visible styles in GraphicsData // its possible that someone wants Graphics just for the bounds this.batchable = true; - return; } - - this.indicesUint16 = new Uint16Array(this.indices); - + // prevent allocation when length is same as buffer + if (this.indicesUint16 && this.indices.length === this.indicesUint16.length) { + this.indicesUint16.set(this.indices); + } + else { + var need32 = attrib > 0xffff && allow32Indices; + this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices); + } // TODO make this a const.. this.batchable = this.isBatchable(); - - if (this.batchable) - { + if (this.batchable) { this.packBatches(); } - else - { + else { this.buildDrawCalls(); } }; - /** * Affinity check * * @param {PIXI.FillStyle | PIXI.LineStyle} styleA * @param {PIXI.FillStyle | PIXI.LineStyle} styleB */ - GraphicsGeometry.prototype._compareStyles = function _compareStyles (styleA, styleB) - { - if (!styleA || !styleB) - { + GraphicsGeometry.prototype._compareStyles = function (styleA, styleB) { + if (!styleA || !styleB) { return false; } - - if (styleA.texture.baseTexture !== styleB.texture.baseTexture) - { + if (styleA.texture.baseTexture !== styleB.texture.baseTexture) { return false; } - - if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) - { + if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha) { return false; } - - if (!!styleA.native !== !!styleB.native) - { + if (!!styleA.native !== !!styleB.native) { return false; } - return true; }; - /** * Test geometry for batching process. * * @protected */ - GraphicsGeometry.prototype.validateBatching = function validateBatching () - { - if (this.dirty === this.cacheDirty || !this.graphicsData.length) - { + GraphicsGeometry.prototype.validateBatching = function () { + if (this.dirty === this.cacheDirty || !this.graphicsData.length) { return false; } - - for (var i = 0, l = this.graphicsData.length; i < l; i++) - { + for (var i = 0, l = this.graphicsData.length; i < l; i++) { var data = this.graphicsData[i]; var fill = data.fillStyle; var line = data.lineStyle; - - if (fill && !fill.texture.baseTexture.valid) { return false; } - if (line && !line.texture.baseTexture.valid) { return false; } + if (fill && !fill.texture.baseTexture.valid) + { return false; } + if (line && !line.texture.baseTexture.valid) + { return false; } } - return true; }; - /** * Offset the indices so that it works with the batcher. * * @protected */ - GraphicsGeometry.prototype.packBatches = function packBatches () - { + GraphicsGeometry.prototype.packBatches = function () { this.batchDirty++; this.uvsFloat32 = new Float32Array(this.uvs); - var batches = this.batches; - - for (var i = 0, l = batches.length; i < l; i++) - { + for (var i = 0, l = batches.length; i < l; i++) { var batch = batches[i]; - - for (var j = 0; j < batch.size; j++) - { + for (var j = 0; j < batch.size; j++) { var index = batch.start + j; - this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart; } } }; - /** * Checks to see if this graphics geometry can be batched. * Currently it needs to be small enough and not contain any native lines. * * @protected */ - GraphicsGeometry.prototype.isBatchable = function isBatchable () - { + GraphicsGeometry.prototype.isBatchable = function () { + // prevent heavy mesh batching + if (this.points.length > 0xffff * 2) { + return false; + } var batches = this.batches; - - for (var i = 0; i < batches.length; i++) - { - if (batches[i].style.native) - { + for (var i = 0; i < batches.length; i++) { + if (batches[i].style.native) { return false; } } - return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2); }; - /** * Converts intermediate batches data to drawCalls. * * @protected */ - GraphicsGeometry.prototype.buildDrawCalls = function buildDrawCalls () - { + GraphicsGeometry.prototype.buildDrawCalls = function () { var TICK = ++BaseTexture._globalBatch; - - for (var i = 0; i < this.drawCalls.length; i++) - { - this.drawCalls[i].textures.length = 0; + for (var i = 0; i < this.drawCalls.length; i++) { + this.drawCalls[i].texArray.clear(); DRAW_CALL_POOL.push(this.drawCalls[i]); } - this.drawCalls.length = 0; - var colors = this.colors; var textureIds = this.textureIds; - - var currentGroup = DRAW_CALL_POOL.pop(); - - if (!currentGroup) - { + var currentGroup = DRAW_CALL_POOL.pop(); + if (!currentGroup) { currentGroup = new BatchDrawCall(); - currentGroup.textures = new BatchTextureArray(); + currentGroup.texArray = new BatchTextureArray(); } - currentGroup.textures.count = 0; + currentGroup.texArray.count = 0; currentGroup.start = 0; currentGroup.size = 0; currentGroup.type = exports.DRAW_MODES.TRIANGLES; - var textureCount = 0; var currentTexture = null; var textureId = 0; var native = false; var drawMode = exports.DRAW_MODES.TRIANGLES; - var index = 0; - this.drawCalls.push(currentGroup); - // TODO - this can be simplified - for (var i$1 = 0; i$1 < this.batches.length; i$1++) - { - var data = this.batches[i$1]; - + for (var i = 0; i < this.batches.length; i++) { + var data = this.batches[i]; // TODO add some full on MAX_TEXTURE CODE.. var MAX_TEXTURES = 8; - + // Forced cast for checking `native` without errors var style = data.style; - var nextTexture = style.texture.baseTexture; - - if (native !== !!style.native) - { + if (native !== !!style.native) { native = !!style.native; drawMode = native ? exports.DRAW_MODES.LINES : exports.DRAW_MODES.TRIANGLES; - // force the batch to break! currentTexture = null; textureCount = MAX_TEXTURES; TICK++; } - - if (currentTexture !== nextTexture) - { + if (currentTexture !== nextTexture) { currentTexture = nextTexture; - - if (nextTexture._batchEnabled !== TICK) - { - if (textureCount === MAX_TEXTURES) - { + if (nextTexture._batchEnabled !== TICK) { + if (textureCount === MAX_TEXTURES) { TICK++; - textureCount = 0; - - if (currentGroup.size > 0) - { + if (currentGroup.size > 0) { currentGroup = DRAW_CALL_POOL.pop(); - if (!currentGroup) - { + if (!currentGroup) { currentGroup = new BatchDrawCall(); - currentGroup.textures = new BatchTextureArray(); + currentGroup.texArray = new BatchTextureArray(); } this.drawCalls.push(currentGroup); } - currentGroup.start = index; currentGroup.size = 0; - currentGroup.textures.count = 0; + currentGroup.texArray.count = 0; currentGroup.type = drawMode; } - // TODO add this to the render part.. - nextTexture.touched = 1;// touch; + // Hack! Because texture has protected `touched` + nextTexture.touched = 1; // touch; nextTexture._batchEnabled = TICK; nextTexture._batchLocation = textureCount; nextTexture.wrapMode = 10497; - - currentGroup.textures.elements[currentGroup.textures.count++] = nextTexture; + currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture; textureCount++; } } - currentGroup.size += data.size; index += data.size; - textureId = nextTexture._batchLocation; - this.addColors(colors, style.color, style.alpha, data.attribSize); this.addTextureIds(textureIds, textureId, data.attribSize); } - BaseTexture._globalBatch = TICK; - // upload.. // merge for now! this.packAttributes(); }; - /** * Packs attributes to single buffer. * * @protected */ - GraphicsGeometry.prototype.packAttributes = function packAttributes () - { + GraphicsGeometry.prototype.packAttributes = function () { var verts = this.points; var uvs = this.uvs; var colors = this.colors; var textureIds = this.textureIds; - // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes var glPoints = new ArrayBuffer(verts.length * 3 * 4); var f32 = new Float32Array(glPoints); var u32 = new Uint32Array(glPoints); - var p = 0; - - for (var i = 0; i < verts.length / 2; i++) - { + for (var i = 0; i < verts.length / 2; i++) { f32[p++] = verts[i * 2]; f32[p++] = verts[(i * 2) + 1]; - f32[p++] = uvs[i * 2]; f32[p++] = uvs[(i * 2) + 1]; - u32[p++] = colors[i]; - f32[p++] = textureIds[i]; } - this._buffer.update(glPoints); this._indexBuffer.update(this.indicesUint16); }; - /** * Process fill part of Graphics. * * @param {PIXI.GraphicsData} data * @protected */ - GraphicsGeometry.prototype.processFill = function processFill (data) - { - if (data.holes.length) - { + GraphicsGeometry.prototype.processFill = function (data) { + if (data.holes.length) { this.processHoles(data.holes); - buildPoly.triangulate(data, this); } - else - { + else { var command = FILL_COMMANDS[data.type]; - command.triangulate(data, this); } }; - /** * Process line part of Graphics. * * @param {PIXI.GraphicsData} data * @protected */ - GraphicsGeometry.prototype.processLine = function processLine (data) - { + GraphicsGeometry.prototype.processLine = function (data) { buildLine(data, this); - - for (var i = 0; i < data.holes.length; i++) - { + for (var i = 0; i < data.holes.length; i++) { buildLine(data.holes[i], this); } }; - /** * Process the holes data. * * @param {PIXI.GraphicsData[]} holes - Holes to render * @protected */ - GraphicsGeometry.prototype.processHoles = function processHoles (holes) - { - for (var i = 0; i < holes.length; i++) - { + GraphicsGeometry.prototype.processHoles = function (holes) { + for (var i = 0; i < holes.length; i++) { var hole = holes[i]; var command = FILL_COMMANDS[hole.type]; - command.build(hole); - - if (hole.matrix) - { + if (hole.matrix) { this.transformPoints(hole.points, hole.matrix); } } }; - /** * Update the local bounds of the object. Expensive to use performance-wise. * * @protected */ - GraphicsGeometry.prototype.calculateBounds = function calculateBounds () - { + GraphicsGeometry.prototype.calculateBounds = function () { var bounds = this._bounds; var sequenceBounds = tmpBounds; var curMatrix = Matrix.IDENTITY; - this._bounds.clear(); sequenceBounds.clear(); - - for (var i = 0; i < this.graphicsData.length; i++) - { + for (var i = 0; i < this.graphicsData.length; i++) { var data = this.graphicsData[i]; var shape = data.shape; var type = data.type; var lineStyle = data.lineStyle; var nextMatrix = data.matrix || Matrix.IDENTITY; var lineWidth = 0.0; - - if (lineStyle && lineStyle.visible) - { + if (lineStyle && lineStyle.visible) { var alignment = lineStyle.alignment; - lineWidth = lineStyle.width; - - if (type === exports.SHAPES.POLY) - { + if (type === exports.SHAPES.POLY) { lineWidth = lineWidth * (0.5 + Math.abs(0.5 - alignment)); } - else - { + else { lineWidth = lineWidth * Math.max(0, alignment); } } - - if (curMatrix !== nextMatrix) - { - if (!sequenceBounds.isEmpty()) - { + if (curMatrix !== nextMatrix) { + if (!sequenceBounds.isEmpty()) { bounds.addBoundsMatrix(sequenceBounds, curMatrix); sequenceBounds.clear(); } curMatrix = nextMatrix; } - - if (type === exports.SHAPES.RECT || type === exports.SHAPES.RREC) - { - sequenceBounds.addFramePad(shape.x, shape.y, shape.x + shape.width, shape.y + shape.height, - lineWidth, lineWidth); + if (type === exports.SHAPES.RECT || type === exports.SHAPES.RREC) { + var rect = shape; + sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, lineWidth, lineWidth); } - else if (type === exports.SHAPES.CIRC) - { - sequenceBounds.addFramePad(shape.x, shape.y, shape.x, shape.y, - shape.radius + lineWidth, shape.radius + lineWidth); + else if (type === exports.SHAPES.CIRC) { + var circle = shape; + sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y, circle.radius + lineWidth, circle.radius + lineWidth); } - else if (type === exports.SHAPES.ELIP) - { - sequenceBounds.addFramePad(shape.x, shape.y, shape.x, shape.y, - shape.width + lineWidth, shape.height + lineWidth); + else if (type === exports.SHAPES.ELIP) { + var ellipse = shape; + sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y, ellipse.width + lineWidth, ellipse.height + lineWidth); } - else - { + else { + var poly = shape; // adding directly to the bounds - bounds.addVerticesMatrix(curMatrix, shape.points, 0, shape.points.length, lineWidth, lineWidth); + bounds.addVerticesMatrix(curMatrix, poly.points, 0, poly.points.length, lineWidth, lineWidth); } } - - if (!sequenceBounds.isEmpty()) - { + if (!sequenceBounds.isEmpty()) { bounds.addBoundsMatrix(sequenceBounds, curMatrix); } - bounds.pad(this.boundsPadding, this.boundsPadding); }; - /** * Transform points using matrix. * @@ -36949,18 +33632,14 @@ var PIXI = (function (exports) { * @param {number[]} points - Points to transform * @param {PIXI.Matrix} matrix - Transform matrix */ - GraphicsGeometry.prototype.transformPoints = function transformPoints (points, matrix) - { - for (var i = 0; i < points.length / 2; i++) - { + GraphicsGeometry.prototype.transformPoints = function (points, matrix) { + for (var i = 0; i < points.length / 2; i++) { var x = points[(i * 2)]; var y = points[(i * 2) + 1]; - points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx; points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty; } }; - /** * Add colors. * @@ -36970,19 +33649,14 @@ var PIXI = (function (exports) { * @param {number} alpha - Alpha to use * @param {number} size - Number of colors to add */ - GraphicsGeometry.prototype.addColors = function addColors (colors, color, alpha, size) - { + GraphicsGeometry.prototype.addColors = function (colors, color, alpha, size) { // TODO use the premultiply bits Ivan added var rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16); - - var rgba = premultiplyTint(rgb, alpha); - - while (size-- > 0) - { + var rgba = premultiplyTint(rgb, alpha); + while (size-- > 0) { colors.push(rgba); } }; - /** * Add texture id that the shader/fragment wants to use. * @@ -36991,14 +33665,11 @@ var PIXI = (function (exports) { * @param {number} id * @param {number} size */ - GraphicsGeometry.prototype.addTextureIds = function addTextureIds (textureIds, id, size) - { - while (size-- > 0) - { + GraphicsGeometry.prototype.addTextureIds = function (textureIds, id, size) { + while (size-- > 0) { textureIds.push(id); } }; - /** * Generates the UVs for a shape. * @@ -37010,50 +33681,38 @@ var PIXI = (function (exports) { * @param {number} size - The size/length for index buffer. * @param {PIXI.Matrix} [matrix] - Optional transform for all points. */ - GraphicsGeometry.prototype.addUvs = function addUvs (verts, uvs, texture, start, size, matrix) - { + GraphicsGeometry.prototype.addUvs = function (verts, uvs, texture, start, size, matrix) { + if (matrix === void 0) { matrix = null; } var index = 0; var uvsStart = uvs.length; var frame = texture.frame; - - while (index < size) - { + while (index < size) { var x = verts[(start + index) * 2]; var y = verts[((start + index) * 2) + 1]; - - if (matrix) - { + if (matrix) { var nx = (matrix.a * x) + (matrix.c * y) + matrix.tx; - y = (matrix.b * x) + (matrix.d * y) + matrix.ty; x = nx; } - index++; - uvs.push(x / frame.width, y / frame.height); } - var baseTexture = texture.baseTexture; - if (frame.width < baseTexture.width - || frame.height < baseTexture.height) - { + || frame.height < baseTexture.height) { this.adjustUvs(uvs, texture, uvsStart, size); } }; - /** * Modify uvs array according to position of texture region * Does not work with rotated or trimmed textures * - * @param {number[]} uvs array - * @param {PIXI.Texture} texture region - * @param {number} start starting index for uvs - * @param {number} size how many points to adjust + * @param {number[]} uvs - array + * @param {PIXI.Texture} texture - region + * @param {number} start - starting index for uvs + * @param {number} size - how many points to adjust */ - GraphicsGeometry.prototype.adjustUvs = function adjustUvs (uvs, texture, start, size) - { + GraphicsGeometry.prototype.adjustUvs = function (uvs, texture, start, size) { var baseTexture = texture.baseTexture; var eps = 1e-6; var finish = start + (size * 2); @@ -37064,56 +33723,91 @@ var PIXI = (function (exports) { var offsetY = frame.y / frame.height; var minX = Math.floor(uvs[start] + eps); var minY = Math.floor(uvs[start + 1] + eps); - - for (var i = start + 2; i < finish; i += 2) - { + for (var i = start + 2; i < finish; i += 2) { minX = Math.min(minX, Math.floor(uvs[i] + eps)); minY = Math.min(minY, Math.floor(uvs[i + 1] + eps)); } offsetX -= minX; offsetY -= minY; - for (var i$1 = start; i$1 < finish; i$1 += 2) - { - uvs[i$1] = (uvs[i$1] + offsetX) * scaleX; - uvs[i$1 + 1] = (uvs[i$1 + 1] + offsetY) * scaleY; + for (var i = start; i < finish; i += 2) { + uvs[i] = (uvs[i] + offsetX) * scaleX; + uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY; } }; - - Object.defineProperties( GraphicsGeometry.prototype, prototypeAccessors ); - + /** + * The maximum number of points to consider an object "batchable", + * able to be batched by the renderer's batch system. + * + * @memberof PIXI.GraphicsGeometry + * @static + * @member {number} BATCHABLE_SIZE + * @default 100 + */ + GraphicsGeometry.BATCHABLE_SIZE = 100; return GraphicsGeometry; }(BatchGeometry)); - /** - * The maximum number of points to consider an object "batchable", - * able to be batched by the renderer's batch system. - * - * @memberof PIXI.GraphicsGeometry - * @static - * @member {number} BATCHABLE_SIZE - * @default 100 - */ - GraphicsGeometry.BATCHABLE_SIZE = 100; - /** * Represents the line style for Graphics. * @memberof PIXI * @class * @extends PIXI.FillStyle */ - var LineStyle = /*@__PURE__*/(function (FillStyle) { - function LineStyle () { - FillStyle.apply(this, arguments); + var LineStyle = /** @class */ (function (_super) { + __extends$5(LineStyle, _super); + function LineStyle() { + var _this = _super !== null && _super.apply(this, arguments) || this; + /** + * The width (thickness) of any lines drawn. + * + * @member {number} + * @default 0 + */ + _this.width = 0; + /** + * The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). + * + * @member {number} + * @default 0.5 + */ + _this.alignment = 0.5; + /** + * If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * + * @member {boolean} + * @default false + */ + _this.native = false; + /** + * Line cap style. + * + * @member {PIXI.LINE_CAP} + * @default PIXI.LINE_CAP.BUTT + */ + _this.cap = exports.LINE_CAP.BUTT; + /** + * Line join style. + * + * @member {PIXI.LINE_JOIN} + * @default PIXI.LINE_JOIN.MITER + */ + _this.join = exports.LINE_JOIN.MITER; + /** + * Miter limit. + * + * @member {number} + * @default 10 + */ + _this.miterLimit = 10; + return _this; } - - if ( FillStyle ) { LineStyle.__proto__ = FillStyle; } - LineStyle.prototype = Object.create( FillStyle && FillStyle.prototype ); - LineStyle.prototype.constructor = LineStyle; - - LineStyle.prototype.clone = function clone () - { + /** + * Clones the object + * + * @return {PIXI.LineStyle} + */ + LineStyle.prototype.clone = function () { var obj = new LineStyle(); - obj.color = this.color; obj.alpha = this.alpha; obj.texture = this.texture; @@ -37122,52 +33816,28 @@ var PIXI = (function (exports) { obj.width = this.width; obj.alignment = this.alignment; obj.native = this.native; - + obj.cap = this.cap; + obj.join = this.join; + obj.miterLimit = this.miterLimit; return obj; }; /** * Reset the line style to default. */ - LineStyle.prototype.reset = function reset () - { - FillStyle.prototype.reset.call(this); - + LineStyle.prototype.reset = function () { + _super.prototype.reset.call(this); // Override default line style color this.color = 0x0; - - /** - * The width (thickness) of any lines drawn. - * - * @member {number} - * @default 0 - */ - this.width = 0; - - /** - * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner). - * - * @member {number} - * @default 0 - */ this.alignment = 0.5; - - /** - * If true the lines will be draw using LINES instead of TRIANGLE_STRIP - * - * @member {boolean} - * @default false - */ + this.width = 0; this.native = false; }; - return LineStyle; }(FillStyle)); var temp = new Float32Array(3); - // a default shaders map used by graphics.. var DEFAULT_SHADERS = {}; - /** * The Graphics class contains methods used to draw primitive shapes such as lines, circles and * rectangles to the display, and to color and fill them. @@ -37181,61 +33851,52 @@ var PIXI = (function (exports) { * @extends PIXI.Container * @memberof PIXI */ - var Graphics = /*@__PURE__*/(function (Container) { - function Graphics(geometry) - { - if ( geometry === void 0 ) { geometry = null; } - - Container.call(this); - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh or Graphics objects. - * @member {PIXI.GraphicsGeometry} - * @readonly - */ - this.geometry = geometry || new GraphicsGeometry(); - - this.geometry.refCount++; - + var Graphics = /** @class */ (function (_super) { + __extends$5(Graphics, _super); + /** + * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted + * will create a new GraphicsGeometry instance. + */ + function Graphics(geometry) { + if (geometry === void 0) { geometry = null; } + var _this = _super.call(this) || this; + _this._geometry = geometry || new GraphicsGeometry(); + _this._geometry.refCount++; /** * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. * Can be shared between multiple Graphics objects. + * * @member {PIXI.Shader} */ - this.shader = null; - + _this.shader = null; /** * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g., * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. + * * @member {PIXI.State} */ - this.state = State.for2d(); - + _this.state = State.for2d(); /** * Current fill style * * @member {PIXI.FillStyle} * @protected */ - this._fillStyle = new FillStyle(); - + _this._fillStyle = new FillStyle(); /** * Current line style * * @member {PIXI.LineStyle} * @protected */ - this._lineStyle = new LineStyle(); - + _this._lineStyle = new LineStyle(); /** * Current shape transform matrix. * * @member {PIXI.Matrix} * @protected */ - this._matrix = null; - + _this._matrix = null; /** * Current hole mode is enabled. * @@ -37243,16 +33904,14 @@ var PIXI = (function (exports) { * @default false * @protected */ - this._holeMode = false; - + _this._holeMode = false; /** * Current path * * @member {PIXI.Polygon} * @protected */ - this.currentPath = null; - + _this.currentPath = null; /** * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite. * This is useful if your graphics element does not change often, as it will speed up the rendering @@ -37265,15 +33924,13 @@ var PIXI = (function (exports) { * @memberof PIXI.Graphics# * @default false */ - /** * A collections of batches! These can be drawn by the renderer batch system. * * @protected * @member {object[]} */ - this.batches = []; - + _this.batches = []; /** * Update dirty for limiting calculating tints for batches. * @@ -37281,107 +33938,121 @@ var PIXI = (function (exports) { * @member {number} * @default -1 */ - this.batchTint = -1; - + _this.batchTint = -1; + /** + * Update dirty for limiting calculating batches. + * + * @protected + * @member {number} + * @default -1 + */ + _this.batchDirty = -1; /** * Copy of the object vertex data. * * @protected * @member {Float32Array} */ - this.vertexData = null; - - this._transformID = -1; - this.batchDirty = -1; - + _this.vertexData = null; /** * Renderer plugin for batching * * @member {string} * @default 'batch' */ - this.pluginName = 'batch'; - + _this.pluginName = 'batch'; + _this._transformID = -1; // Set default - this.tint = 0xFFFFFF; - this.blendMode = exports.BLEND_MODES.NORMAL; + _this.tint = 0xFFFFFF; + _this.blendMode = exports.BLEND_MODES.NORMAL; + return _this; } - - if ( Container ) { Graphics.__proto__ = Container; } - Graphics.prototype = Object.create( Container && Container.prototype ); - Graphics.prototype.constructor = Graphics; - - var prototypeAccessors = { blendMode: { configurable: true },tint: { configurable: true },fill: { configurable: true },line: { configurable: true } }; - + Object.defineProperty(Graphics.prototype, "geometry", { + /** + * Includes vertex positions, face indices, normals, colors, UVs, and + * custom attributes within buffers, reducing the cost of passing all + * this data to the GPU. Can be shared between multiple Mesh or Graphics objects. + * + * @member {PIXI.GraphicsGeometry} + * @readonly + */ + get: function () { + return this._geometry; + }, + enumerable: false, + configurable: true + }); /** * Creates a new Graphics object with the same values as this one. - * Note that the only the properties of the object are cloned, not its transform (position,scale,etc) + * Note that only the geometry of the object is cloned, not its transform (position,scale,etc) * * @return {PIXI.Graphics} A clone of the graphics object */ - Graphics.prototype.clone = function clone () - { + Graphics.prototype.clone = function () { this.finishPoly(); - - return new Graphics(this.geometry); + return new Graphics(this._geometry); }; - - /** - * The blend mode to be applied to the graphic shape. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - prototypeAccessors.blendMode.set = function (value) - { - this.state.blendMode = value; - }; - - prototypeAccessors.blendMode.get = function () - { - return this.state.blendMode; - }; - - /** - * The tint applied to the graphic shape. This is a hex value. A value of - * 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.get = function () - { - return this._tint; - }; - prototypeAccessors.tint.set = function (value) - { - this._tint = value; - }; - - /** - * The current fill style. - * - * @member {PIXI.FillStyle} - * @readonly - */ - prototypeAccessors.fill.get = function () - { - return this._fillStyle; - }; - - /** - * The current line style. - * - * @member {PIXI.LineStyle} - * @readonly - */ - prototypeAccessors.line.get = function () - { - return this._lineStyle; - }; - + Object.defineProperty(Graphics.prototype, "blendMode", { + get: function () { + return this.state.blendMode; + }, + /** + * The blend mode to be applied to the graphic shape. Apply a value of + * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL; + * @see PIXI.BLEND_MODES + */ + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "tint", { + /** + * The tint applied to the graphic shape. This is a hex value. A value of + * 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "fill", { + /** + * The current fill style. + * + * @member {PIXI.FillStyle} + * @readonly + */ + get: function () { + return this._fillStyle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Graphics.prototype, "line", { + /** + * The current line style. + * + * @member {PIXI.LineStyle} + * @readonly + */ + get: function () { + return this._lineStyle; + }, + enumerable: false, + configurable: true + }); /** * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo() * method or the drawCircle() method. @@ -37404,15 +34075,17 @@ var PIXI = (function (exports) { * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style + * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style + * @param {number}[options.miterLimit=10] - miter limit ratio * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.lineStyle = function lineStyle (options) - { + Graphics.prototype.lineStyle = function (options) { + if (options === void 0) { options = null; } // Support non-object params: (width, color, alpha, alignment, native) - if (typeof options === 'number') - { + if (typeof options === 'number') { + // eslint-disable-next-line var args = arguments; - options = { width: args[0] || 0, color: args[1] || 0x0, @@ -37421,10 +34094,8 @@ var PIXI = (function (exports) { native: !!args[4], }; } - return this.lineTextureStyle(options); }; - /** * Like line style but support texture for line fill. * @@ -37434,33 +34105,25 @@ var PIXI = (function (exports) { * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style. * Default 0xFFFFFF if texture present. * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style - * @param {PIXI.Matrix} [options.matrix=null] Texture matrix to transform texture + * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outter) * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP + * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style + * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style + * @param {number}[options.miterLimit=10] - miter limit ratio * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.lineTextureStyle = function lineTextureStyle (options) - { + Graphics.prototype.lineTextureStyle = function (options) { // backward compatibility with params: (width, texture, // color, alpha, matrix, alignment, native) - if (typeof options === 'number') - { + if (typeof options === 'number') { deprecation('v5.2.0', 'Please use object-based options for Graphics#lineTextureStyle'); - - var width = arguments[0]; - var texture = arguments[1]; - var color = arguments[2]; - var alpha = arguments[3]; - var matrix = arguments[4]; - var alignment = arguments[5]; - var native = arguments[6]; - + // eslint-disable-next-line + var _a = arguments, width = _a[0], texture = _a[1], color = _a[2], alpha = _a[3], matrix = _a[4], alignment = _a[5], native = _a[6]; options = { width: width, texture: texture, color: color, alpha: alpha, matrix: matrix, alignment: alignment, native: native }; - // Remove undefined keys Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); } - // Apply defaults options = Object.assign({ width: 0, @@ -37470,79 +34133,61 @@ var PIXI = (function (exports) { matrix: null, alignment: 0.5, native: false, + cap: exports.LINE_CAP.BUTT, + join: exports.LINE_JOIN.MITER, + miterLimit: 10, }, options); - - if (this.currentPath) - { + if (this.currentPath) { this.startPoly(); } - var visible = options.width > 0 && options.alpha > 0; - - if (!visible) - { + if (!visible) { this._lineStyle.reset(); } - else - { - if (options.matrix) - { + else { + if (options.matrix) { options.matrix = options.matrix.clone(); options.matrix.invert(); } - Object.assign(this._lineStyle, { visible: visible }, options); } - return this; }; - /** * Start a polygon object internally * @protected */ - Graphics.prototype.startPoly = function startPoly () - { - if (this.currentPath) - { + Graphics.prototype.startPoly = function () { + if (this.currentPath) { var points = this.currentPath.points; var len = this.currentPath.points.length; - - if (len > 2) - { + if (len > 2) { this.drawShape(this.currentPath); this.currentPath = new Polygon(); this.currentPath.closeStroke = false; this.currentPath.points.push(points[len - 2], points[len - 1]); } } - else - { + else { this.currentPath = new Polygon(); this.currentPath.closeStroke = false; } }; - /** * Finish the polygon object. * @protected */ - Graphics.prototype.finishPoly = function finishPoly () - { - if (this.currentPath) - { - if (this.currentPath.points.length > 2) - { + Graphics.prototype.finishPoly = function () { + if (this.currentPath) { + if (this.currentPath.points.length > 2) { this.drawShape(this.currentPath); this.currentPath = null; } - else - { + else { this.currentPath.points.length = 0; } } }; - /** * Moves the current drawing position to x, y. * @@ -37550,15 +34195,12 @@ var PIXI = (function (exports) { * @param {number} y - the Y coordinate to move to * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.moveTo = function moveTo (x, y) - { + Graphics.prototype.moveTo = function (x, y) { this.startPoly(); this.currentPath.points[0] = x; this.currentPath.points[1] = y; - return this; }; - /** * Draws a line using the current line style from the current drawing position to (x, y); * The current drawing position is then set to (x, y). @@ -37567,26 +34209,19 @@ var PIXI = (function (exports) { * @param {number} y - the Y coordinate to draw to * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.lineTo = function lineTo (x, y) - { - if (!this.currentPath) - { + Graphics.prototype.lineTo = function (x, y) { + if (!this.currentPath) { this.moveTo(0, 0); } - // remove duplicates.. var points = this.currentPath.points; var fromX = points[points.length - 2]; var fromY = points[points.length - 1]; - - if (fromX !== x || fromY !== y) - { + if (fromX !== x || fromY !== y) { points.push(x, y); } - return this; }; - /** * Initialize the curve * @@ -37594,24 +34229,18 @@ var PIXI = (function (exports) { * @param {number} [x=0] * @param {number} [y=0] */ - Graphics.prototype._initCurve = function _initCurve (x, y) - { - if ( x === void 0 ) { x = 0; } - if ( y === void 0 ) { y = 0; } - - if (this.currentPath) - { - if (this.currentPath.points.length === 0) - { + Graphics.prototype._initCurve = function (x, y) { + if (x === void 0) { x = 0; } + if (y === void 0) { y = 0; } + if (this.currentPath) { + if (this.currentPath.points.length === 0) { this.currentPath.points = [x, y]; } } - else - { + else { this.moveTo(x, y); } }; - /** * Calculate the points for a quadratic bezier curve and then draws it. * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c @@ -37622,22 +34251,15 @@ var PIXI = (function (exports) { * @param {number} toY - Destination point y * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.quadraticCurveTo = function quadraticCurveTo (cpX, cpY, toX, toY) - { + Graphics.prototype.quadraticCurveTo = function (cpX, cpY, toX, toY) { this._initCurve(); - var points = this.currentPath.points; - - if (points.length === 0) - { + if (points.length === 0) { this.moveTo(0, 0); } - QuadraticUtils.curveTo(cpX, cpY, toX, toY, points); - return this; }; - /** * Calculate the points for a bezier curve and then draws it. * @@ -37649,15 +34271,11 @@ var PIXI = (function (exports) { * @param {number} toY - Destination point y * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.bezierCurveTo = function bezierCurveTo (cpX, cpY, cpX2, cpY2, toX, toY) - { + Graphics.prototype.bezierCurveTo = function (cpX, cpY, cpX2, cpY2, toX, toY) { this._initCurve(); - BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points); - return this; }; - /** * The arcTo() method creates an arc/curve between two tangents on the canvas. * @@ -37670,29 +34288,16 @@ var PIXI = (function (exports) { * @param {number} radius - The radius of the arc * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius) - { + Graphics.prototype.arcTo = function (x1, y1, x2, y2, radius) { this._initCurve(x1, y1); - var points = this.currentPath.points; - var result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points); - - if (result) - { - var cx = result.cx; - var cy = result.cy; - var radius$1 = result.radius; - var startAngle = result.startAngle; - var endAngle = result.endAngle; - var anticlockwise = result.anticlockwise; - - this.arc(cx, cy, radius$1, startAngle, endAngle, anticlockwise); + if (result) { + var cx = result.cx, cy = result.cy, radius_1 = result.radius, startAngle = result.startAngle, endAngle = result.endAngle, anticlockwise = result.anticlockwise; + this.arc(cx, cy, radius_1, startAngle, endAngle, anticlockwise); } - return this; }; - /** * The arc method creates an arc/curve (used to create circles, or parts of circles). * @@ -37707,64 +34312,43 @@ var PIXI = (function (exports) { * indicates counter-clockwise. * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.arc = function arc (cx, cy, radius, startAngle, endAngle, anticlockwise) - { - if ( anticlockwise === void 0 ) { anticlockwise = false; } - - if (startAngle === endAngle) - { + Graphics.prototype.arc = function (cx, cy, radius, startAngle, endAngle, anticlockwise) { + if (anticlockwise === void 0) { anticlockwise = false; } + if (startAngle === endAngle) { return this; } - - if (!anticlockwise && endAngle <= startAngle) - { + if (!anticlockwise && endAngle <= startAngle) { endAngle += PI_2; } - else if (anticlockwise && startAngle <= endAngle) - { + else if (anticlockwise && startAngle <= endAngle) { startAngle += PI_2; } - var sweep = endAngle - startAngle; - - if (sweep === 0) - { + if (sweep === 0) { return this; } - var startX = cx + (Math.cos(startAngle) * radius); var startY = cy + (Math.sin(startAngle) * radius); - var eps = this.geometry.closePointEps; - + var eps = this._geometry.closePointEps; // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path. var points = this.currentPath ? this.currentPath.points : null; - - if (points) - { + if (points) { // TODO: make a better fix. - // We check how far our start is from the last existing point var xDiff = Math.abs(points[points.length - 2] - startX); var yDiff = Math.abs(points[points.length - 1] - startY); - - if (xDiff < eps && yDiff < eps) - { ; } - else - { + if (xDiff < eps && yDiff < eps) { ; } + else { points.push(startX, startY); } } - else - { + else { this.moveTo(startX, startY); points = this.currentPath.points; } - ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points); - return this; }; - /** * Specifies a simple one-color fill that subsequent calls to other Graphics methods * (such as lineTo() or drawCircle()) use when drawing. @@ -37773,14 +34357,11 @@ var PIXI = (function (exports) { * @param {number} [alpha=1] - the alpha of the fill * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.beginFill = function beginFill (color, alpha) - { - if ( color === void 0 ) { color = 0; } - if ( alpha === void 0 ) { alpha = 1; } - + Graphics.prototype.beginFill = function (color, alpha) { + if (color === void 0) { color = 0; } + if (alpha === void 0) { alpha = 1; } return this.beginTextureFill({ texture: Texture.WHITE, color: color, alpha: alpha }); }; - /** * Begin the texture fill * @@ -37791,24 +34372,16 @@ var PIXI = (function (exports) { * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.beginTextureFill = function beginTextureFill (options) - { + Graphics.prototype.beginTextureFill = function (options) { // backward compatibility with params: (texture, color, alpha, matrix) - if (options instanceof Texture) - { + if (options instanceof Texture) { deprecation('v5.2.0', 'Please use object-based options for Graphics#beginTextureFill'); - - var texture = arguments[0]; - var color = arguments[1]; - var alpha = arguments[2]; - var matrix = arguments[3]; - + // eslint-disable-next-line + var _a = arguments, texture = _a[0], color = _a[1], alpha = _a[2], matrix = _a[3]; options = { texture: texture, color: color, alpha: alpha, matrix: matrix }; - // Remove undefined keys Object.keys(options).forEach(function (key) { return options[key] === undefined && delete options[key]; }); } - // Apply defaults options = Object.assign({ texture: Texture.WHITE, @@ -37816,46 +34389,32 @@ var PIXI = (function (exports) { alpha: 1, matrix: null, }, options); - - if (this.currentPath) - { + if (this.currentPath) { this.startPoly(); } - var visible = options.alpha > 0; - - if (!visible) - { + if (!visible) { this._fillStyle.reset(); } - else - { - if (options.matrix) - { + else { + if (options.matrix) { options.matrix = options.matrix.clone(); options.matrix.invert(); } - Object.assign(this._fillStyle, { visible: visible }, options); } - return this; }; - /** * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method. * * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.endFill = function endFill () - { + Graphics.prototype.endFill = function () { this.finishPoly(); - this._fillStyle.reset(); - return this; }; - /** * Draws a rectangle shape. * @@ -37865,11 +34424,9 @@ var PIXI = (function (exports) { * @param {number} height - The height of the rectangle * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawRect = function drawRect (x, y, width, height) - { + Graphics.prototype.drawRect = function (x, y, width, height) { return this.drawShape(new Rectangle(x, y, width, height)); }; - /** * Draw a rectangle shape with rounded/beveled corners. * @@ -37880,11 +34437,9 @@ var PIXI = (function (exports) { * @param {number} radius - Radius of the rectangle corners * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawRoundedRect = function drawRoundedRect (x, y, width, height, radius) - { + Graphics.prototype.drawRoundedRect = function (x, y, width, height, radius) { return this.drawShape(new RoundedRectangle(x, y, width, height, radius)); }; - /** * Draws a circle. * @@ -37893,11 +34448,9 @@ var PIXI = (function (exports) { * @param {number} radius - The radius of the circle * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawCircle = function drawCircle (x, y, radius) - { + Graphics.prototype.drawCircle = function (x, y, radius) { return this.drawShape(new Circle(x, y, radius)); }; - /** * Draws an ellipse. * @@ -37907,80 +34460,56 @@ var PIXI = (function (exports) { * @param {number} height - The half height of the ellipse * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawEllipse = function drawEllipse (x, y, width, height) - { + Graphics.prototype.drawEllipse = function (x, y, width, height) { return this.drawShape(new Ellipse(x, y, width, height)); }; - /** * Draws a polygon using the given path. * * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon. * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawPolygon = function drawPolygon (path) - { + Graphics.prototype.drawPolygon = function () { var arguments$1 = arguments; - // prevents an argument assignment deopt - // see section 3.1: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments - var points = path; - - var closeStroke = true;// !!this._fillStyle; - + var path = []; + for (var _i = 0; _i < arguments.length; _i++) { + path[_i] = arguments$1[_i]; + } + var points; + var closeStroke = true; // !!this._fillStyle; + var poly = path[0]; // check if data has points.. - if (points.points) - { - closeStroke = points.closeStroke; - points = points.points; + if (poly.points) { + closeStroke = poly.closeStroke; + points = poly.points; } - - if (!Array.isArray(points)) - { - // prevents an argument leak deopt - // see section 3.2: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments - points = new Array(arguments.length); - - for (var i = 0; i < points.length; ++i) - { - points[i] = arguments$1[i]; // eslint-disable-line prefer-rest-params - } + else if (Array.isArray(path[0])) { + points = path[0]; + } + else { + points = path; } - var shape = new Polygon(points); - shape.closeStroke = closeStroke; - this.drawShape(shape); - return this; }; - /** * Draw any shape. * * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawShape = function drawShape (shape) - { - if (!this._holeMode) - { - this.geometry.drawShape( - shape, - this._fillStyle.clone(), - this._lineStyle.clone(), - this._matrix - ); + Graphics.prototype.drawShape = function (shape) { + if (!this._holeMode) { + this._geometry.drawShape(shape, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix); } - else - { - this.geometry.drawHole(shape, this._matrix); + else { + this._geometry.drawHole(shape, this._matrix); } - return this; }; - /** * Draw a star shape with an arbitrary number of points. * @@ -37992,111 +34521,82 @@ var PIXI = (function (exports) { * @param {number} [rotation=0] - The rotation of the star in radians, where 0 is vertical * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.drawStar = function drawStar (x, y, points, radius, innerRadius, rotation) - { - if ( rotation === void 0 ) { rotation = 0; } - + Graphics.prototype.drawStar = function (x, y, points, radius, innerRadius, rotation) { + if (rotation === void 0) { rotation = 0; } return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation)); }; - /** * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings. * * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls */ - Graphics.prototype.clear = function clear () - { - this.geometry.clear(); + Graphics.prototype.clear = function () { + this._geometry.clear(); this._lineStyle.reset(); this._fillStyle.reset(); - + this._boundsID++; this._matrix = null; this._holeMode = false; this.currentPath = null; - return this; }; - /** * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and * masked with gl.scissor. * * @returns {boolean} True if only 1 rect. */ - Graphics.prototype.isFastRect = function isFastRect () - { - return this.geometry.graphicsData.length === 1 - && this.geometry.graphicsData[0].shape.type === exports.SHAPES.RECT - && !this.geometry.graphicsData[0].lineWidth; + Graphics.prototype.isFastRect = function () { + var data = this._geometry.graphicsData; + return data.length === 1 + && data[0].shape.type === exports.SHAPES.RECT + && !(data[0].lineStyle.visible && data[0].lineStyle.width); }; - /** * Renders the object using the WebGL renderer * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Graphics.prototype._render = function _render (renderer) - { + Graphics.prototype._render = function (renderer) { this.finishPoly(); - - var geometry = this.geometry; - + var geometry = this._geometry; + var hasuit32 = renderer.context.supports.uint32Indices; // batch part.. // batch it! - geometry.updateBatches(); - - if (geometry.batchable) - { - if (this.batchDirty !== geometry.batchDirty) - { + geometry.updateBatches(hasuit32); + if (geometry.batchable) { + if (this.batchDirty !== geometry.batchDirty) { this._populateBatches(); } - this._renderBatched(renderer); } - else - { + else { // no batching... renderer.batch.flush(); - this._renderDirect(renderer); } }; - /** * Populating batches for rendering * * @protected */ - Graphics.prototype._populateBatches = function _populateBatches () - { - var geometry = this.geometry; + Graphics.prototype._populateBatches = function () { + var geometry = this._geometry; var blendMode = this.blendMode; - - this.batches = []; + var len = geometry.batches.length; this.batchTint = -1; this._transformID = -1; this.batchDirty = geometry.batchDirty; - + this.batches.length = len; this.vertexData = new Float32Array(geometry.points); - - for (var i = 0, l = geometry.batches.length; i < l; i++) - { + for (var i = 0; i < len; i++) { var gI = geometry.batches[i]; var color = gI.style.color; - var vertexData = new Float32Array(this.vertexData.buffer, - gI.attribStart * 4 * 2, - gI.attribSize * 2); - - var uvs = new Float32Array(geometry.uvsFloat32.buffer, - gI.attribStart * 4 * 2, - gI.attribSize * 2); - - var indices = new Uint16Array(geometry.indicesUint16.buffer, - gI.start * 2, - gI.size); - + var vertexData = new Float32Array(this.vertexData.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); + var uvs = new Float32Array(geometry.uvsFloat32.buffer, gI.attribStart * 4 * 2, gI.attribSize * 2); + var indices = new Uint16Array(geometry.indicesUint16.buffer, gI.start * 2, gI.size); var batch = { vertexData: vertexData, blendMode: blendMode, @@ -38106,233 +34606,165 @@ var PIXI = (function (exports) { _tintRGB: color, _texture: gI.style.texture, alpha: gI.style.alpha, - worldAlpha: 1 }; - + worldAlpha: 1 + }; this.batches[i] = batch; } }; - /** * Renders the batches using the BathedRenderer plugin * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Graphics.prototype._renderBatched = function _renderBatched (renderer) - { - if (!this.batches.length) - { + Graphics.prototype._renderBatched = function (renderer) { + if (!this.batches.length) { return; } - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); - this.calculateVertices(); this.calculateTints(); - - for (var i = 0, l = this.batches.length; i < l; i++) - { + for (var i = 0, l = this.batches.length; i < l; i++) { var batch = this.batches[i]; - batch.worldAlpha = this.worldAlpha * batch.alpha; - renderer.plugins[this.pluginName].render(batch); } }; - /** * Renders the graphics direct * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Graphics.prototype._renderDirect = function _renderDirect (renderer) - { + Graphics.prototype._renderDirect = function (renderer) { var shader = this._resolveDirectShader(renderer); - - var geometry = this.geometry; + var geometry = this._geometry; var tint = this.tint; var worldAlpha = this.worldAlpha; var uniforms = shader.uniforms; var drawCalls = geometry.drawCalls; - // lets set the transfomr uniforms.translationMatrix = this.transform.worldTransform; - // and then lets set the tint.. uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha; uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha; uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha; uniforms.tint[3] = worldAlpha; - // the first draw call, we can set the uniforms of the shader directly here. - // this means that we can tack advantage of the sync function of pixi! // bind and sync uniforms.. // there is a way to optimise this.. renderer.shader.bind(shader); renderer.geometry.bind(geometry, shader); - // set state.. renderer.state.set(this.state); - // then render the rest of them... - for (var i = 0, l = drawCalls.length; i < l; i++) - { + for (var i = 0, l = drawCalls.length; i < l; i++) { this._renderDrawCallDirect(renderer, geometry.drawCalls[i]); } }; - /** * Renders specific DrawCall * * @param {PIXI.Renderer} renderer * @param {PIXI.BatchDrawCall} drawCall */ - Graphics.prototype._renderDrawCallDirect = function _renderDrawCallDirect (renderer, drawCall) - { - var textures = drawCall.textures; - var type = drawCall.type; - var size = drawCall.size; - var start = drawCall.start; - var groupTextureCount = textures.count; - - for (var j = 0; j < groupTextureCount; j++) - { - renderer.texture.bind(textures.elements[j], j); + Graphics.prototype._renderDrawCallDirect = function (renderer, drawCall) { + var texArray = drawCall.texArray, type = drawCall.type, size = drawCall.size, start = drawCall.start; + var groupTextureCount = texArray.count; + for (var j = 0; j < groupTextureCount; j++) { + renderer.texture.bind(texArray.elements[j], j); } - renderer.geometry.draw(type, size, start); }; - /** * Resolves shader for direct rendering * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Graphics.prototype._resolveDirectShader = function _resolveDirectShader (renderer) - { + Graphics.prototype._resolveDirectShader = function (renderer) { var shader = this.shader; - var pluginName = this.pluginName; - - if (!shader) - { + if (!shader) { // if there is no shader here, we can use the default shader. // and that only gets created if we actually need it.. // but may be more than one plugins for graphics - if (!DEFAULT_SHADERS[pluginName]) - { + if (!DEFAULT_SHADERS[pluginName]) { var sampleValues = new Int32Array(16); - - for (var i = 0; i < 16; i++) - { + for (var i = 0; i < 16; i++) { sampleValues[i] = i; } - var uniforms = { tint: new Float32Array([1, 1, 1, 1]), translationMatrix: new Matrix(), default: UniformGroup.from({ uSamplers: sampleValues }, true), }; - var program = renderer.plugins[pluginName]._shader.program; - DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms); } - shader = DEFAULT_SHADERS[pluginName]; } - return shader; }; - /** * Retrieves the bounds of the graphic shape as a rectangle object * * @protected */ - Graphics.prototype._calculateBounds = function _calculateBounds () - { + Graphics.prototype._calculateBounds = function () { this.finishPoly(); - - var geometry = this.geometry; - + var geometry = this._geometry; // skipping when graphics is empty, like a container - if (!geometry.graphicsData.length) - { + if (!geometry.graphicsData.length) { return; } - - var ref = geometry.bounds; - var minX = ref.minX; - var minY = ref.minY; - var maxX = ref.maxX; - var maxY = ref.maxY; - + var _a = geometry.bounds, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY; this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); }; - /** * Tests if a point is inside this graphics object * - * @param {PIXI.Point} point - the point to test + * @param {PIXI.IPointData} point - the point to test * @return {boolean} the result of the test */ - Graphics.prototype.containsPoint = function containsPoint (point) - { + Graphics.prototype.containsPoint = function (point) { this.worldTransform.applyInverse(point, Graphics._TEMP_POINT); - - return this.geometry.containsPoint(Graphics._TEMP_POINT); + return this._geometry.containsPoint(Graphics._TEMP_POINT); }; - /** * Recalcuate the tint by applying tin to batches using Graphics tint. * @protected */ - Graphics.prototype.calculateTints = function calculateTints () - { - if (this.batchTint !== this.tint) - { + Graphics.prototype.calculateTints = function () { + if (this.batchTint !== this.tint) { this.batchTint = this.tint; - var tintRGB = hex2rgb(this.tint, temp); - - for (var i = 0; i < this.batches.length; i++) - { + for (var i = 0; i < this.batches.length; i++) { var batch = this.batches[i]; - var batchTint = batch._batchRGB; - var r = (tintRGB[0] * batchTint[0]) * 255; var g = (tintRGB[1] * batchTint[1]) * 255; var b = (tintRGB[2] * batchTint[2]) * 255; - // TODO Ivan, can this be done in one go? var color = (r << 16) + (g << 8) + (b | 0); - batch._tintRGB = (color >> 16) - + (color & 0xff00) - + ((color & 0xff) << 16); + + (color & 0xff00) + + ((color & 0xff) << 16); } } }; - /** * If there's a transform update or a change to the shape of the * geometry, recaculate the vertices. * @protected */ - Graphics.prototype.calculateVertices = function calculateVertices () - { - if (this._transformID === this.transform._worldID) - { + Graphics.prototype.calculateVertices = function () { + var wtID = this.transform._worldID; + if (this._transformID === wtID) { return; } - - this._transformID = this.transform._worldID; - + this._transformID = wtID; var wt = this.transform.worldTransform; var a = wt.a; var b = wt.b; @@ -38340,53 +34772,39 @@ var PIXI = (function (exports) { var d = wt.d; var tx = wt.tx; var ty = wt.ty; - - var data = this.geometry.points;// batch.vertexDataOriginal; + var data = this._geometry.points; // batch.vertexDataOriginal; var vertexData = this.vertexData; - var count = 0; - - for (var i = 0; i < data.length; i += 2) - { + for (var i = 0; i < data.length; i += 2) { var x = data[i]; var y = data[i + 1]; - vertexData[count++] = (a * x) + (c * y) + tx; vertexData[count++] = (d * y) + (b * x) + ty; } }; - /** * Closes the current path. * * @return {PIXI.Graphics} Returns itself. */ - Graphics.prototype.closePath = function closePath () - { + Graphics.prototype.closePath = function () { var currentPath = this.currentPath; - - if (currentPath) - { + if (currentPath) { // we don't need to add extra point in the end because buildLine will take care of that currentPath.closeStroke = true; } - return this; }; - /** * Apply a matrix to the positional data. * * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape. * @return {PIXI.Graphics} Returns itself. */ - Graphics.prototype.setMatrix = function setMatrix (matrix) - { + Graphics.prototype.setMatrix = function (matrix) { this._matrix = matrix; - return this; }; - /** * Begin adding holes to the last draw shape * IMPORTANT: holes must be fully inside a shape to work @@ -38395,26 +34813,20 @@ var PIXI = (function (exports) { * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle. * @return {PIXI.Graphics} Returns itself. */ - Graphics.prototype.beginHole = function beginHole () - { + Graphics.prototype.beginHole = function () { this.finishPoly(); this._holeMode = true; - return this; }; - /** * End adding holes to the last draw shape * @return {PIXI.Graphics} Returns itself. */ - Graphics.prototype.endHole = function endHole () - { + Graphics.prototype.endHole = function () { this.finishPoly(); this._holeMode = false; - return this; }; - /** * Destroys the Graphics object. * @@ -38427,56 +34839,75 @@ var PIXI = (function (exports) { * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true * Should it destroy the base texture of the child sprite */ - Graphics.prototype.destroy = function destroy (options) - { - Container.prototype.destroy.call(this, options); - - this.geometry.refCount--; - if (this.geometry.refCount === 0) - { - this.geometry.dispose(); + Graphics.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this._geometry.refCount--; + if (this._geometry.refCount === 0) { + this._geometry.dispose(); } - this._matrix = null; this.currentPath = null; this._lineStyle.destroy(); this._lineStyle = null; this._fillStyle.destroy(); this._fillStyle = null; - this.geometry = null; + this._geometry = null; this.shader = null; this.vertexData = null; this.batches.length = 0; this.batches = null; - - Container.prototype.destroy.call(this, options); + _super.prototype.destroy.call(this, options); }; - - Object.defineProperties( Graphics.prototype, prototypeAccessors ); - + /** + * Temporary point to use for containsPoint + * + * @static + * @private + * @member {PIXI.Point} + */ + Graphics._TEMP_POINT = new Point(); return Graphics; }(Container)); - /** - * Temporary point to use for containsPoint - * - * @static - * @private - * @member {PIXI.Point} - */ - Graphics._TEMP_POINT = new Point(); - /*! - * @pixi/sprite - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/sprite - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/sprite is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$6 = function(d, b) { + extendStatics$6 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$6(d, b); + }; + + function __extends$6(d, b) { + extendStatics$6(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + var tempPoint = new Point(); var indices = new Uint16Array([0, 1, 2, 0, 2, 3]); - /** * The Sprite object is the base for all textured objects that are rendered to the screen * @@ -38503,11 +34934,13 @@ var PIXI = (function (exports) { * @extends PIXI.Container * @memberof PIXI */ - var Sprite = /*@__PURE__*/(function (Container) { - function Sprite(texture) - { - Container.call(this); - + var Sprite = /** @class */ (function (_super) { + __extends$6(Sprite, _super); + /** + * @param {PIXI.Texture} [texture] - The texture for this sprite. + */ + function Sprite(texture) { + var _this = _super.call(this) || this; /** * The anchor point defines the normalized coordinates * in the texture that map to the position of this @@ -38526,37 +34959,28 @@ var PIXI = (function (exports) { * @member {PIXI.ObservablePoint} * @private */ - this._anchor = new ObservablePoint( - this._onAnchorUpdate, - this, - (texture ? texture.defaultAnchor.x : 0), - (texture ? texture.defaultAnchor.y : 0) - ); - + _this._anchor = new ObservablePoint(_this._onAnchorUpdate, _this, (texture ? texture.defaultAnchor.x : 0), (texture ? texture.defaultAnchor.y : 0)); /** * The texture that the sprite is using * * @private * @member {PIXI.Texture} */ - this._texture = null; - + _this._texture = null; /** * The width of the sprite (this is initially set by the texture) * - * @private + * @protected * @member {number} */ - this._width = 0; - + _this._width = 0; /** * The height of the sprite (this is initially set by the texture) * - * @private + * @protected * @member {number} */ - this._height = 0; - + _this._height = 0; /** * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. * @@ -38564,10 +34988,16 @@ var PIXI = (function (exports) { * @member {number} * @default 0xFFFFFF */ - this._tint = null; - this._tintRGB = null; - this.tint = 0xFFFFFF; - + _this._tint = null; + /** + * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect. + * + * @private + * @member {number} + * @default 16777215 + */ + _this._tintRGB = null; + _this.tint = 0xFFFFFF; /** * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. * @@ -38575,15 +35005,7 @@ var PIXI = (function (exports) { * @default PIXI.BLEND_MODES.NORMAL * @see PIXI.BLEND_MODES */ - this.blendMode = exports.BLEND_MODES.NORMAL; - - /** - * The shader that will be used to render the sprite. Set to null to remove a current shader. - * - * @member {PIXI.Filter|PIXI.Shader} - */ - this.shader = null; - + _this.blendMode = exports.BLEND_MODES.NORMAL; /** * Cached tint value so we can tell when the tint is changed. * Value is used for 2d CanvasRenderer. @@ -38592,8 +35014,7 @@ var PIXI = (function (exports) { * @member {number} * @default 0xFFFFFF */ - this._cachedTint = 0xFFFFFF; - + _this._cachedTint = 0xFFFFFF; /** * this is used to store the uvs data of the sprite, assigned at the same time * as the vertexData in calculateVertices() @@ -38601,39 +35022,30 @@ var PIXI = (function (exports) { * @private * @member {Float32Array} */ - this.uvs = null; - + _this.uvs = null; // call texture setter - this.texture = texture || Texture.EMPTY; - + _this.texture = texture || Texture.EMPTY; /** * this is used to store the vertex data of the sprite (basically a quad) * * @private * @member {Float32Array} */ - this.vertexData = new Float32Array(8); - + _this.vertexData = new Float32Array(8); /** * This is used to calculate the bounds of the object IF it is a trimmed sprite * * @private * @member {Float32Array} */ - this.vertexTrimmedData = null; - - this._transformID = -1; - this._textureID = -1; - - this._transformTrimmedID = -1; - this._textureTrimmedID = -1; - + _this.vertexTrimmedData = null; + _this._transformID = -1; + _this._textureID = -1; + _this._transformTrimmedID = -1; + _this._textureTrimmedID = -1; // Batchable stuff.. // TODO could make this a mixin? - this.indices = indices; - this.size = 4; - this.start = 0; - + _this.indices = indices; /** * Plugin that is responsible for rendering this element. * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods. @@ -38641,86 +35053,62 @@ var PIXI = (function (exports) { * @member {string} * @default 'batch' */ - this.pluginName = 'batch'; - + _this.pluginName = 'batch'; /** * used to fast check if a sprite is.. a sprite! * @member {boolean} */ - this.isSprite = true; - + _this.isSprite = true; /** * Internal roundPixels field * * @member {boolean} * @private */ - this._roundPixels = settings.ROUND_PIXELS; + _this._roundPixels = settings.ROUND_PIXELS; + return _this; } - - if ( Container ) { Sprite.__proto__ = Container; } - Sprite.prototype = Object.create( Container && Container.prototype ); - Sprite.prototype.constructor = Sprite; - - var prototypeAccessors = { roundPixels: { configurable: true },width: { configurable: true },height: { configurable: true },anchor: { configurable: true },tint: { configurable: true },texture: { configurable: true } }; - /** * When the texture is updated, this event will fire to update the scale and frame * - * @private + * @protected */ - Sprite.prototype._onTextureUpdate = function _onTextureUpdate () - { + Sprite.prototype._onTextureUpdate = function () { this._textureID = -1; this._textureTrimmedID = -1; this._cachedTint = 0xFFFFFF; - // so if _width is 0 then width was not set.. - if (this._width) - { + if (this._width) { this.scale.x = sign$1(this.scale.x) * this._width / this._texture.orig.width; } - - if (this._height) - { + if (this._height) { this.scale.y = sign$1(this.scale.y) * this._height / this._texture.orig.height; } }; - /** * Called when the anchor position updates. * * @private */ - Sprite.prototype._onAnchorUpdate = function _onAnchorUpdate () - { + Sprite.prototype._onAnchorUpdate = function () { this._transformID = -1; this._transformTrimmedID = -1; }; - /** * calculates worldTransform * vertices, store it in vertexData */ - Sprite.prototype.calculateVertices = function calculateVertices () - { + Sprite.prototype.calculateVertices = function () { var texture = this._texture; - - if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) - { + if (this._transformID === this.transform._worldID && this._textureID === texture._updateID) { return; } - // update texture UV here, because base texture can be changed without calling `_onTextureUpdate` - if (this._textureID !== texture._updateID) - { + if (this._textureID !== texture._updateID) { this.uvs = this._texture._uvs.uvsFloat32; } - this._transformID = this.transform._worldID; this._textureID = texture._updateID; - // set the vertex data - var wt = this.transform.worldTransform; var a = wt.a; var b = wt.b; @@ -38732,82 +35120,61 @@ var PIXI = (function (exports) { var trim = texture.trim; var orig = texture.orig; var anchor = this._anchor; - var w0 = 0; var w1 = 0; var h0 = 0; var h1 = 0; - - if (trim) - { + if (trim) { // if the sprite is trimmed and is not a tilingsprite then we need to add the extra // space before transforming the sprite coords. w1 = trim.x - (anchor._x * orig.width); w0 = w1 + trim.width; - h1 = trim.y - (anchor._y * orig.height); h0 = h1 + trim.height; } - else - { + else { w1 = -anchor._x * orig.width; w0 = w1 + orig.width; - h1 = -anchor._y * orig.height; h0 = h1 + orig.height; } - // xy vertexData[0] = (a * w1) + (c * h1) + tx; vertexData[1] = (d * h1) + (b * w1) + ty; - // xy vertexData[2] = (a * w0) + (c * h1) + tx; vertexData[3] = (d * h1) + (b * w0) + ty; - // xy vertexData[4] = (a * w0) + (c * h0) + tx; vertexData[5] = (d * h0) + (b * w0) + ty; - // xy vertexData[6] = (a * w1) + (c * h0) + tx; vertexData[7] = (d * h0) + (b * w1) + ty; - - if (this._roundPixels) - { + if (this._roundPixels) { var resolution = settings.RESOLUTION; - - for (var i = 0; i < vertexData.length; ++i) - { + for (var i = 0; i < vertexData.length; ++i) { vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); } } }; - /** * calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData * This is used to ensure that the true width and height of a trimmed texture is respected */ - Sprite.prototype.calculateTrimmedVertices = function calculateTrimmedVertices () - { - if (!this.vertexTrimmedData) - { + Sprite.prototype.calculateTrimmedVertices = function () { + if (!this.vertexTrimmedData) { this.vertexTrimmedData = new Float32Array(8); } - else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) - { + else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) { return; } - this._transformTrimmedID = this.transform._worldID; this._textureTrimmedID = this._texture._updateID; - // lets do some special trim code! var texture = this._texture; var vertexData = this.vertexTrimmedData; var orig = texture.orig; var anchor = this._anchor; - // lets calculate the new untrimmed bounds.. var wt = this.transform.worldTransform; var a = wt.a; @@ -38816,30 +35183,23 @@ var PIXI = (function (exports) { var d = wt.d; var tx = wt.tx; var ty = wt.ty; - var w1 = -anchor._x * orig.width; var w0 = w1 + orig.width; - var h1 = -anchor._y * orig.height; var h0 = h1 + orig.height; - // xy vertexData[0] = (a * w1) + (c * h1) + tx; vertexData[1] = (d * h1) + (b * w1) + ty; - // xy vertexData[2] = (a * w0) + (c * h1) + tx; vertexData[3] = (d * h1) + (b * w0) + ty; - // xy vertexData[4] = (a * w0) + (c * h0) + tx; vertexData[5] = (d * h0) + (b * w0) + ty; - // xy vertexData[6] = (a * w1) + (c * h0) + tx; vertexData[7] = (d * h0) + (b * w1) + ty; }; - /** * * Renders the object using the WebGL renderer @@ -38847,99 +35207,74 @@ var PIXI = (function (exports) { * @protected * @param {PIXI.Renderer} renderer - The webgl renderer to use. */ - Sprite.prototype._render = function _render (renderer) - { + Sprite.prototype._render = function (renderer) { this.calculateVertices(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); renderer.plugins[this.pluginName].render(this); }; - /** * Updates the bounds of the sprite. * * @protected */ - Sprite.prototype._calculateBounds = function _calculateBounds () - { + Sprite.prototype._calculateBounds = function () { var trim = this._texture.trim; var orig = this._texture.orig; - // First lets check to see if the current texture has a trim.. - if (!trim || (trim.width === orig.width && trim.height === orig.height)) - { + if (!trim || (trim.width === orig.width && trim.height === orig.height)) { // no trim! lets use the usual calculations.. this.calculateVertices(); this._bounds.addQuad(this.vertexData); } - else - { + else { // lets calculate a special trimmed bounds... this.calculateTrimmedVertices(); this._bounds.addQuad(this.vertexTrimmedData); } }; - /** * Gets the local bounds of the sprite object. * * @param {PIXI.Rectangle} [rect] - The output rectangle. * @return {PIXI.Rectangle} The bounds. */ - Sprite.prototype.getLocalBounds = function getLocalBounds (rect) - { + Sprite.prototype.getLocalBounds = function (rect) { // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) - { + if (this.children.length === 0) { this._bounds.minX = this._texture.orig.width * -this._anchor._x; this._bounds.minY = this._texture.orig.height * -this._anchor._y; this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x); this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y); - - if (!rect) - { - if (!this._localBoundsRect) - { + if (!rect) { + if (!this._localBoundsRect) { this._localBoundsRect = new Rectangle(); } - rect = this._localBoundsRect; } - return this._bounds.getRectangle(rect); } - - return Container.prototype.getLocalBounds.call(this, rect); + return _super.prototype.getLocalBounds.call(this, rect); }; - /** * Tests if a point is inside this sprite * - * @param {PIXI.Point} point - the point to test + * @param {PIXI.IPointData} point - the point to test * @return {boolean} the result of the test */ - Sprite.prototype.containsPoint = function containsPoint (point) - { + Sprite.prototype.containsPoint = function (point) { this.worldTransform.applyInverse(point, tempPoint); - var width = this._texture.orig.width; var height = this._texture.orig.height; var x1 = -width * this.anchor.x; var y1 = 0; - - if (tempPoint.x >= x1 && tempPoint.x < x1 + width) - { + if (tempPoint.x >= x1 && tempPoint.x < x1 + width) { y1 = -height * this.anchor.y; - - if (tempPoint.y >= y1 && tempPoint.y < y1 + height) - { + if (tempPoint.y >= y1 && tempPoint.y < y1 + height) { return true; } } - return false; }; - /** * Destroys this sprite and optionally its texture and children * @@ -38950,207 +35285,208 @@ var PIXI = (function (exports) { * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well */ - Sprite.prototype.destroy = function destroy (options) - { - Container.prototype.destroy.call(this, options); - + Sprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); this._texture.off('update', this._onTextureUpdate, this); - this._anchor = null; - var destroyTexture = typeof options === 'boolean' ? options : options && options.texture; - - if (destroyTexture) - { + if (destroyTexture) { var destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture; - this._texture.destroy(!!destroyBaseTexture); } - this._texture = null; - this.shader = null; }; - // some helper functions.. - /** * Helper function that creates a new sprite based on the source you provide. * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static - * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source Source to create texture from - * @param {object} [options] See {@link PIXI.BaseTexture}'s constructor for options. + * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from + * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. * @return {PIXI.Sprite} The newly created sprite */ - Sprite.from = function from (source, options) - { + Sprite.from = function (source, options) { var texture = (source instanceof Texture) ? source : Texture.from(source, options); - return new Sprite(texture); }; - - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - prototypeAccessors.roundPixels.set = function (value) - { - if (this._roundPixels !== value) - { - this._transformID = -1; - } - this._roundPixels = value; - }; - - prototypeAccessors.roundPixels.get = function () - { - return this._roundPixels; - }; - - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return Math.abs(this.scale.x) * this._texture.orig.width; - }; - - prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc - { - var s = sign$1(this.scale.x) || 1; - - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }; - - /** - * The height of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return Math.abs(this.scale.y) * this._texture.orig.height; - }; - - prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc - { - var s = sign$1(this.scale.y) || 1; - - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }; - - /** - * The anchor sets the origin point of the text. The default value is taken from the {@link PIXI.Texture|Texture} - * and passed to the constructor. - * - * The default is `(0,0)`, this means the text's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. - * - * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. - * - * @example - * const sprite = new PIXI.Sprite(texture); - * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). - * - * @member {PIXI.ObservablePoint} - */ - prototypeAccessors.anchor.get = function () - { - return this._anchor; - }; - - prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc - { - this._anchor.copyFrom(value); - }; - - /** - * The tint applied to the sprite. This is a hex value. - * A value of 0xFFFFFF will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.get = function () - { - return this._tint; - }; - - prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc - { - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - }; - - /** - * The texture that the sprite is using - * - * @member {PIXI.Texture} - */ - prototypeAccessors.texture.get = function () - { - return this._texture; - }; - - prototypeAccessors.texture.set = function (value) // eslint-disable-line require-jsdoc - { - if (this._texture === value) - { - return; - } - - if (this._texture) - { - this._texture.off('update', this._onTextureUpdate, this); - } - - this._texture = value || Texture.EMPTY; - this._cachedTint = 0xFFFFFF; - - this._textureID = -1; - this._textureTrimmedID = -1; - - if (value) - { - // wait for the texture to load - if (value.baseTexture.valid) - { - this._onTextureUpdate(); + Object.defineProperty(Sprite.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} + * + * @member {boolean} + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; } - else - { - value.once('update', this._onTextureUpdate, this); + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "width", { + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + var s = sign$1(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "height", { + /** + * The height of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + var s = sign$1(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "anchor", { + /** + * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture} + * and passed to the constructor. + * + * The default is `(0,0)`, this means the sprite's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner. + * + * If you pass only single parameter, it will set both x and y to the same value as shown in the example below. + * + * @example + * const sprite = new PIXI.Sprite(texture); + * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5). + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this._anchor; + }, + set: function (value) { + this._anchor.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "tint", { + /** + * The tint applied to the sprite. This is a hex value. + * A value of 0xFFFFFF will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this._tint; + }, + set: function (value) { + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Sprite.prototype, "texture", { + /** + * The texture that the sprite is using + * + * @member {PIXI.Texture} + */ + get: function () { + return this._texture; + }, + set: function (value) { + if (this._texture === value) { + return; } - } - }; - - Object.defineProperties( Sprite.prototype, prototypeAccessors ); - + if (this._texture) { + this._texture.off('update', this._onTextureUpdate, this); + } + this._texture = value || Texture.EMPTY; + this._cachedTint = 0xFFFFFF; + this._textureID = -1; + this._textureTrimmedID = -1; + if (value) { + // wait for the texture to load + if (value.baseTexture.valid) { + this._onTextureUpdate(); + } + else { + value.once('update', this._onTextureUpdate, this); + } + } + }, + enumerable: false, + configurable: true + }); return Sprite; }(Container)); /*! - * @pixi/text - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/text - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/text is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$7 = function(d, b) { + extendStatics$7 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$7(d, b); + }; + + function __extends$7(d, b) { + extendStatics$7(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + /** * Constants that define the type of gradient on text. * @@ -39162,13 +35498,13 @@ var PIXI = (function (exports) { * @property {number} LINEAR_VERTICAL Vertical gradient * @property {number} LINEAR_HORIZONTAL Linear gradient */ - var TEXT_GRADIENT = { - LINEAR_VERTICAL: 0, - LINEAR_HORIZONTAL: 1, - }; + + (function (TEXT_GRADIENT) { + TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_VERTICAL"] = 0] = "LINEAR_VERTICAL"; + TEXT_GRADIENT[TEXT_GRADIENT["LINEAR_HORIZONTAL"] = 1] = "LINEAR_HORIZONTAL"; + })(exports.TEXT_GRADIENT || (exports.TEXT_GRADIENT = {})); // disabling eslint for now, going to rewrite this in v5 - var defaultStyle = { align: 'left', breakWords: false, @@ -39179,7 +35515,7 @@ var PIXI = (function (exports) { dropShadowColor: 'black', dropShadowDistance: 5, fill: 'black', - fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL, + fillGradientType: exports.TEXT_GRADIENT.LINEAR_VERTICAL, fillGradientStops: [], fontFamily: 'Arial', fontSize: 26, @@ -39200,7 +35536,6 @@ var PIXI = (function (exports) { wordWrapWidth: 100, leading: 0, }; - var genericFontFamilies = [ 'serif', 'sans-serif', @@ -39208,7 +35543,6 @@ var PIXI = (function (exports) { 'cursive', 'fantasy', 'system-ui' ]; - /** * A TextStyle Object contains information to decorate a Text objects. * @@ -39219,712 +35553,720 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var TextStyle = function TextStyle(style) - { - this.styleID = 0; - - this.reset(); - - deepCopyProperties(this, style, style); - }; - - var prototypeAccessors$7 = { align: { configurable: true },breakWords: { configurable: true },dropShadow: { configurable: true },dropShadowAlpha: { configurable: true },dropShadowAngle: { configurable: true },dropShadowBlur: { configurable: true },dropShadowColor: { configurable: true },dropShadowDistance: { configurable: true },fill: { configurable: true },fillGradientType: { configurable: true },fillGradientStops: { configurable: true },fontFamily: { configurable: true },fontSize: { configurable: true },fontStyle: { configurable: true },fontVariant: { configurable: true },fontWeight: { configurable: true },letterSpacing: { configurable: true },lineHeight: { configurable: true },leading: { configurable: true },lineJoin: { configurable: true },miterLimit: { configurable: true },padding: { configurable: true },stroke: { configurable: true },strokeThickness: { configurable: true },textBaseline: { configurable: true },trim: { configurable: true },whiteSpace: { configurable: true },wordWrap: { configurable: true },wordWrapWidth: { configurable: true } }; - - /** - * Creates a new TextStyle object with the same values as this one. - * Note that the only the properties of the object are cloned. - * - * @return {PIXI.TextStyle} New cloned TextStyle object - */ - TextStyle.prototype.clone = function clone () - { - var clonedProperties = {}; - - deepCopyProperties(clonedProperties, this, defaultStyle); - - return new TextStyle(clonedProperties); - }; - - /** - * Resets all properties to the defaults specified in TextStyle.prototype._default - */ - TextStyle.prototype.reset = function reset () - { - deepCopyProperties(this, defaultStyle, defaultStyle); - }; - - /** - * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text - * - * @member {string} - */ - prototypeAccessors$7.align.get = function () - { - return this._align; - }; - prototypeAccessors$7.align.set = function (align) // eslint-disable-line require-jsdoc - { - if (this._align !== align) - { - this._align = align; - this.styleID++; + var TextStyle = /** @class */ (function () { + /** + * @param {object} [style] - The style parameters + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), + * does not affect single line text + * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it + * needs wordWrap to be set to true + * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text + * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow + * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow + * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius + * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow + * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas + * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient + * eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours + * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT} + * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set + * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * @param {string|string[]} [style.fontFamily='Arial'] - The font family + * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string, + * equivalents are '26px','20pt','160%' or '1.6em') + * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique') + * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps') + * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100', + * '200', '300', '400', '500', '600', '700', '800' or '900') + * @param {number} [style.leading=0] - The space between lines + * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0 + * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses + * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve + * spiked text issues. Possible values "miter" (creates a sharp corner), "round" (creates a round corner) or "bevel" + * (creates a squared corner). + * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce + * or increase the spikiness of rendered text. + * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from + * happening by adding padding to all sides of the text. + * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * @param {boolean} [style.trim=false] - Trim transparent borders + * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered. + * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved "normal" + * (collapse, collapse), "pre" (preserve, preserve) | "pre-line" (preserve, collapse). It needs wordWrap to be set to true + * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used + * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true + */ + function TextStyle(style) { + this.styleID = 0; + this.reset(); + deepCopyProperties(this, style, style); } - }; - - /** - * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true - * - * @member {boolean} - */ - prototypeAccessors$7.breakWords.get = function () - { - return this._breakWords; - }; - prototypeAccessors$7.breakWords.set = function (breakWords) // eslint-disable-line require-jsdoc - { - if (this._breakWords !== breakWords) - { - this._breakWords = breakWords; - this.styleID++; - } - }; - - /** - * Set a drop shadow for the text - * - * @member {boolean} - */ - prototypeAccessors$7.dropShadow.get = function () - { - return this._dropShadow; - }; - prototypeAccessors$7.dropShadow.set = function (dropShadow) // eslint-disable-line require-jsdoc - { - if (this._dropShadow !== dropShadow) - { - this._dropShadow = dropShadow; - this.styleID++; - } - }; - - /** - * Set alpha for the drop shadow - * - * @member {number} - */ - prototypeAccessors$7.dropShadowAlpha.get = function () - { - return this._dropShadowAlpha; - }; - prototypeAccessors$7.dropShadowAlpha.set = function (dropShadowAlpha) // eslint-disable-line require-jsdoc - { - if (this._dropShadowAlpha !== dropShadowAlpha) - { - this._dropShadowAlpha = dropShadowAlpha; - this.styleID++; - } - }; - - /** - * Set a angle of the drop shadow - * - * @member {number} - */ - prototypeAccessors$7.dropShadowAngle.get = function () - { - return this._dropShadowAngle; - }; - prototypeAccessors$7.dropShadowAngle.set = function (dropShadowAngle) // eslint-disable-line require-jsdoc - { - if (this._dropShadowAngle !== dropShadowAngle) - { - this._dropShadowAngle = dropShadowAngle; - this.styleID++; - } - }; - - /** - * Set a shadow blur radius - * - * @member {number} - */ - prototypeAccessors$7.dropShadowBlur.get = function () - { - return this._dropShadowBlur; - }; - prototypeAccessors$7.dropShadowBlur.set = function (dropShadowBlur) // eslint-disable-line require-jsdoc - { - if (this._dropShadowBlur !== dropShadowBlur) - { - this._dropShadowBlur = dropShadowBlur; - this.styleID++; - } - }; - - /** - * A fill style to be used on the dropshadow e.g 'red', '#00FF00' - * - * @member {string|number} - */ - prototypeAccessors$7.dropShadowColor.get = function () - { - return this._dropShadowColor; - }; - prototypeAccessors$7.dropShadowColor.set = function (dropShadowColor) // eslint-disable-line require-jsdoc - { - var outputColor = getColor(dropShadowColor); - if (this._dropShadowColor !== outputColor) - { - this._dropShadowColor = outputColor; - this.styleID++; - } - }; - - /** - * Set a distance of the drop shadow - * - * @member {number} - */ - prototypeAccessors$7.dropShadowDistance.get = function () - { - return this._dropShadowDistance; - }; - prototypeAccessors$7.dropShadowDistance.set = function (dropShadowDistance) // eslint-disable-line require-jsdoc - { - if (this._dropShadowDistance !== dropShadowDistance) - { - this._dropShadowDistance = dropShadowDistance; - this.styleID++; - } - }; - - /** - * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. - * Can be an array to create a gradient eg ['#000000','#FFFFFF'] - * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} - * - * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} - */ - prototypeAccessors$7.fill.get = function () - { - return this._fill; - }; - prototypeAccessors$7.fill.set = function (fill) // eslint-disable-line require-jsdoc - { - var outputColor = getColor(fill); - if (this._fill !== outputColor) - { - this._fill = outputColor; - this.styleID++; - } - }; - - /** - * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. - * See {@link PIXI.TEXT_GRADIENT} - * - * @member {number} - */ - prototypeAccessors$7.fillGradientType.get = function () - { - return this._fillGradientType; - }; - prototypeAccessors$7.fillGradientType.set = function (fillGradientType) // eslint-disable-line require-jsdoc - { - if (this._fillGradientType !== fillGradientType) - { - this._fillGradientType = fillGradientType; - this.styleID++; - } - }; - - /** - * If fill is an array of colours to create a gradient, this array can set the stop points - * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. - * - * @member {number[]} - */ - prototypeAccessors$7.fillGradientStops.get = function () - { - return this._fillGradientStops; - }; - prototypeAccessors$7.fillGradientStops.set = function (fillGradientStops) // eslint-disable-line require-jsdoc - { - if (!areArraysEqual(this._fillGradientStops,fillGradientStops)) - { - this._fillGradientStops = fillGradientStops; - this.styleID++; - } - }; - - /** - * The font family - * - * @member {string|string[]} - */ - prototypeAccessors$7.fontFamily.get = function () - { - return this._fontFamily; - }; - prototypeAccessors$7.fontFamily.set = function (fontFamily) // eslint-disable-line require-jsdoc - { - if (this.fontFamily !== fontFamily) - { - this._fontFamily = fontFamily; - this.styleID++; - } - }; - - /** - * The font size - * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') - * - * @member {number|string} - */ - prototypeAccessors$7.fontSize.get = function () - { - return this._fontSize; - }; - prototypeAccessors$7.fontSize.set = function (fontSize) // eslint-disable-line require-jsdoc - { - if (this._fontSize !== fontSize) - { - this._fontSize = fontSize; - this.styleID++; - } - }; - - /** - * The font style - * ('normal', 'italic' or 'oblique') - * - * @member {string} - */ - prototypeAccessors$7.fontStyle.get = function () - { - return this._fontStyle; - }; - prototypeAccessors$7.fontStyle.set = function (fontStyle) // eslint-disable-line require-jsdoc - { - if (this._fontStyle !== fontStyle) - { - this._fontStyle = fontStyle; - this.styleID++; - } - }; - - /** - * The font variant - * ('normal' or 'small-caps') - * - * @member {string} - */ - prototypeAccessors$7.fontVariant.get = function () - { - return this._fontVariant; - }; - prototypeAccessors$7.fontVariant.set = function (fontVariant) // eslint-disable-line require-jsdoc - { - if (this._fontVariant !== fontVariant) - { - this._fontVariant = fontVariant; - this.styleID++; - } - }; - - /** - * The font weight - * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') - * - * @member {string} - */ - prototypeAccessors$7.fontWeight.get = function () - { - return this._fontWeight; - }; - prototypeAccessors$7.fontWeight.set = function (fontWeight) // eslint-disable-line require-jsdoc - { - if (this._fontWeight !== fontWeight) - { - this._fontWeight = fontWeight; - this.styleID++; - } - }; - - /** - * The amount of spacing between letters, default is 0 - * - * @member {number} - */ - prototypeAccessors$7.letterSpacing.get = function () - { - return this._letterSpacing; - }; - prototypeAccessors$7.letterSpacing.set = function (letterSpacing) // eslint-disable-line require-jsdoc - { - if (this._letterSpacing !== letterSpacing) - { - this._letterSpacing = letterSpacing; - this.styleID++; - } - }; - - /** - * The line height, a number that represents the vertical space that a letter uses - * - * @member {number} - */ - prototypeAccessors$7.lineHeight.get = function () - { - return this._lineHeight; - }; - prototypeAccessors$7.lineHeight.set = function (lineHeight) // eslint-disable-line require-jsdoc - { - if (this._lineHeight !== lineHeight) - { - this._lineHeight = lineHeight; - this.styleID++; - } - }; - - /** - * The space between lines - * - * @member {number} - */ - prototypeAccessors$7.leading.get = function () - { - return this._leading; - }; - prototypeAccessors$7.leading.set = function (leading) // eslint-disable-line require-jsdoc - { - if (this._leading !== leading) - { - this._leading = leading; - this.styleID++; - } - }; - - /** - * The lineJoin property sets the type of corner created, it can resolve spiked text issues. - * Default is 'miter' (creates a sharp corner). - * - * @member {string} - */ - prototypeAccessors$7.lineJoin.get = function () - { - return this._lineJoin; - }; - prototypeAccessors$7.lineJoin.set = function (lineJoin) // eslint-disable-line require-jsdoc - { - if (this._lineJoin !== lineJoin) - { - this._lineJoin = lineJoin; - this.styleID++; - } - }; - - /** - * The miter limit to use when using the 'miter' lineJoin mode - * This can reduce or increase the spikiness of rendered text. - * - * @member {number} - */ - prototypeAccessors$7.miterLimit.get = function () - { - return this._miterLimit; - }; - prototypeAccessors$7.miterLimit.set = function (miterLimit) // eslint-disable-line require-jsdoc - { - if (this._miterLimit !== miterLimit) - { - this._miterLimit = miterLimit; - this.styleID++; - } - }; - - /** - * Occasionally some fonts are cropped. Adding some padding will prevent this from happening - * by adding padding to all sides of the text. - * - * @member {number} - */ - prototypeAccessors$7.padding.get = function () - { - return this._padding; - }; - prototypeAccessors$7.padding.set = function (padding) // eslint-disable-line require-jsdoc - { - if (this._padding !== padding) - { - this._padding = padding; - this.styleID++; - } - }; - - /** - * A canvas fillstyle that will be used on the text stroke - * e.g 'blue', '#FCFF00' - * - * @member {string|number} - */ - prototypeAccessors$7.stroke.get = function () - { - return this._stroke; - }; - prototypeAccessors$7.stroke.set = function (stroke) // eslint-disable-line require-jsdoc - { - var outputColor = getColor(stroke); - if (this._stroke !== outputColor) - { - this._stroke = outputColor; - this.styleID++; - } - }; - - /** - * A number that represents the thickness of the stroke. - * Default is 0 (no stroke) - * - * @member {number} - */ - prototypeAccessors$7.strokeThickness.get = function () - { - return this._strokeThickness; - }; - prototypeAccessors$7.strokeThickness.set = function (strokeThickness) // eslint-disable-line require-jsdoc - { - if (this._strokeThickness !== strokeThickness) - { - this._strokeThickness = strokeThickness; - this.styleID++; - } - }; - - /** - * The baseline of the text that is rendered. - * - * @member {string} - */ - prototypeAccessors$7.textBaseline.get = function () - { - return this._textBaseline; - }; - prototypeAccessors$7.textBaseline.set = function (textBaseline) // eslint-disable-line require-jsdoc - { - if (this._textBaseline !== textBaseline) - { - this._textBaseline = textBaseline; - this.styleID++; - } - }; - - /** - * Trim transparent borders - * - * @member {boolean} - */ - prototypeAccessors$7.trim.get = function () - { - return this._trim; - }; - prototypeAccessors$7.trim.set = function (trim) // eslint-disable-line require-jsdoc - { - if (this._trim !== trim) - { - this._trim = trim; - this.styleID++; - } - }; - - /** - * How newlines and spaces should be handled. - * Default is 'pre' (preserve, preserve). - * - * value | New lines | Spaces - * --- | --- | --- - * 'normal' | Collapse | Collapse - * 'pre' | Preserve | Preserve - * 'pre-line' | Preserve | Collapse - * - * @member {string} - */ - prototypeAccessors$7.whiteSpace.get = function () - { - return this._whiteSpace; - }; - prototypeAccessors$7.whiteSpace.set = function (whiteSpace) // eslint-disable-line require-jsdoc - { - if (this._whiteSpace !== whiteSpace) - { - this._whiteSpace = whiteSpace; - this.styleID++; - } - }; - - /** - * Indicates if word wrap should be used - * - * @member {boolean} - */ - prototypeAccessors$7.wordWrap.get = function () - { - return this._wordWrap; - }; - prototypeAccessors$7.wordWrap.set = function (wordWrap) // eslint-disable-line require-jsdoc - { - if (this._wordWrap !== wordWrap) - { - this._wordWrap = wordWrap; - this.styleID++; - } - }; - - /** - * The width at which text will wrap, it needs wordWrap to be set to true - * - * @member {number} - */ - prototypeAccessors$7.wordWrapWidth.get = function () - { - return this._wordWrapWidth; - }; - prototypeAccessors$7.wordWrapWidth.set = function (wordWrapWidth) // eslint-disable-line require-jsdoc - { - if (this._wordWrapWidth !== wordWrapWidth) - { - this._wordWrapWidth = wordWrapWidth; - this.styleID++; - } - }; - - /** - * Generates a font style string to use for `TextMetrics.measureFont()`. - * - * @return {string} Font style string, for passing to `TextMetrics.measureFont()` - */ - TextStyle.prototype.toFontString = function toFontString () - { - // build canvas api font setting from individual components. Convert a numeric this.fontSize to px - var fontSizeString = (typeof this.fontSize === 'number') ? ((this.fontSize) + "px") : this.fontSize; - - // Clean-up fontFamily property by quoting each font name - // this will support font names with spaces - var fontFamilies = this.fontFamily; - - if (!Array.isArray(this.fontFamily)) - { - fontFamilies = this.fontFamily.split(','); - } - - for (var i = fontFamilies.length - 1; i >= 0; i--) - { - // Trim any extra white-space - var fontFamily = fontFamilies[i].trim(); - - // Check if font already contains strings - if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) - { - fontFamily = "\"" + fontFamily + "\""; + /** + * Creates a new TextStyle object with the same values as this one. + * Note that the only the properties of the object are cloned. + * + * @return {PIXI.TextStyle} New cloned TextStyle object + */ + TextStyle.prototype.clone = function () { + var clonedProperties = {}; + deepCopyProperties(clonedProperties, this, defaultStyle); + return new TextStyle(clonedProperties); + }; + /** + * Resets all properties to the defaults specified in TextStyle.prototype._default + */ + TextStyle.prototype.reset = function () { + deepCopyProperties(this, defaultStyle, defaultStyle); + }; + Object.defineProperty(TextStyle.prototype, "align", { + /** + * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text + * + * @member {string} + */ + get: function () { + return this._align; + }, + set: function (align) { + if (this._align !== align) { + this._align = align; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "breakWords", { + /** + * Indicates if lines can be wrapped within words, it needs wordWrap to be set to true + * + * @member {boolean} + */ + get: function () { + return this._breakWords; + }, + set: function (breakWords) { + if (this._breakWords !== breakWords) { + this._breakWords = breakWords; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadow", { + /** + * Set a drop shadow for the text + * + * @member {boolean} + */ + get: function () { + return this._dropShadow; + }, + set: function (dropShadow) { + if (this._dropShadow !== dropShadow) { + this._dropShadow = dropShadow; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowAlpha", { + /** + * Set alpha for the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowAlpha; + }, + set: function (dropShadowAlpha) { + if (this._dropShadowAlpha !== dropShadowAlpha) { + this._dropShadowAlpha = dropShadowAlpha; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowAngle", { + /** + * Set a angle of the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowAngle; + }, + set: function (dropShadowAngle) { + if (this._dropShadowAngle !== dropShadowAngle) { + this._dropShadowAngle = dropShadowAngle; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowBlur", { + /** + * Set a shadow blur radius + * + * @member {number} + */ + get: function () { + return this._dropShadowBlur; + }, + set: function (dropShadowBlur) { + if (this._dropShadowBlur !== dropShadowBlur) { + this._dropShadowBlur = dropShadowBlur; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowColor", { + /** + * A fill style to be used on the dropshadow e.g 'red', '#00FF00' + * + * @member {string|number} + */ + get: function () { + return this._dropShadowColor; + }, + set: function (dropShadowColor) { + var outputColor = getColor(dropShadowColor); + if (this._dropShadowColor !== outputColor) { + this._dropShadowColor = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "dropShadowDistance", { + /** + * Set a distance of the drop shadow + * + * @member {number} + */ + get: function () { + return this._dropShadowDistance; + }, + set: function (dropShadowDistance) { + if (this._dropShadowDistance !== dropShadowDistance) { + this._dropShadowDistance = dropShadowDistance; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fill", { + /** + * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'. + * Can be an array to create a gradient eg ['#000000','#FFFFFF'] + * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN} + * + * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern} + */ + get: function () { + return this._fill; + }, + set: function (fill) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in + // without casting here. + var outputColor = getColor(fill); + if (this._fill !== outputColor) { + this._fill = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fillGradientType", { + /** + * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient. + * See {@link PIXI.TEXT_GRADIENT} + * + * @member {number} + */ + get: function () { + return this._fillGradientType; + }, + set: function (fillGradientType) { + if (this._fillGradientType !== fillGradientType) { + this._fillGradientType = fillGradientType; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fillGradientStops", { + /** + * If fill is an array of colours to create a gradient, this array can set the stop points + * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them. + * + * @member {number[]} + */ + get: function () { + return this._fillGradientStops; + }, + set: function (fillGradientStops) { + if (!areArraysEqual(this._fillGradientStops, fillGradientStops)) { + this._fillGradientStops = fillGradientStops; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontFamily", { + /** + * The font family + * + * @member {string|string[]} + */ + get: function () { + return this._fontFamily; + }, + set: function (fontFamily) { + if (this.fontFamily !== fontFamily) { + this._fontFamily = fontFamily; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontSize", { + /** + * The font size + * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em') + * + * @member {number|string} + */ + get: function () { + return this._fontSize; + }, + set: function (fontSize) { + if (this._fontSize !== fontSize) { + this._fontSize = fontSize; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontStyle", { + /** + * The font style + * ('normal', 'italic' or 'oblique') + * + * @member {string} + */ + get: function () { + return this._fontStyle; + }, + set: function (fontStyle) { + if (this._fontStyle !== fontStyle) { + this._fontStyle = fontStyle; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontVariant", { + /** + * The font variant + * ('normal' or 'small-caps') + * + * @member {string} + */ + get: function () { + return this._fontVariant; + }, + set: function (fontVariant) { + if (this._fontVariant !== fontVariant) { + this._fontVariant = fontVariant; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "fontWeight", { + /** + * The font weight + * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900') + * + * @member {string} + */ + get: function () { + return this._fontWeight; + }, + set: function (fontWeight) { + if (this._fontWeight !== fontWeight) { + this._fontWeight = fontWeight; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "letterSpacing", { + /** + * The amount of spacing between letters, default is 0 + * + * @member {number} + */ + get: function () { + return this._letterSpacing; + }, + set: function (letterSpacing) { + if (this._letterSpacing !== letterSpacing) { + this._letterSpacing = letterSpacing; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "lineHeight", { + /** + * The line height, a number that represents the vertical space that a letter uses + * + * @member {number} + */ + get: function () { + return this._lineHeight; + }, + set: function (lineHeight) { + if (this._lineHeight !== lineHeight) { + this._lineHeight = lineHeight; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "leading", { + /** + * The space between lines + * + * @member {number} + */ + get: function () { + return this._leading; + }, + set: function (leading) { + if (this._leading !== leading) { + this._leading = leading; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "lineJoin", { + /** + * The lineJoin property sets the type of corner created, it can resolve spiked text issues. + * Default is 'miter' (creates a sharp corner). + * + * @member {string} + */ + get: function () { + return this._lineJoin; + }, + set: function (lineJoin) { + if (this._lineJoin !== lineJoin) { + this._lineJoin = lineJoin; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "miterLimit", { + /** + * The miter limit to use when using the 'miter' lineJoin mode + * This can reduce or increase the spikiness of rendered text. + * + * @member {number} + */ + get: function () { + return this._miterLimit; + }, + set: function (miterLimit) { + if (this._miterLimit !== miterLimit) { + this._miterLimit = miterLimit; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "padding", { + /** + * Occasionally some fonts are cropped. Adding some padding will prevent this from happening + * by adding padding to all sides of the text. + * + * @member {number} + */ + get: function () { + return this._padding; + }, + set: function (padding) { + if (this._padding !== padding) { + this._padding = padding; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "stroke", { + /** + * A canvas fillstyle that will be used on the text stroke + * e.g 'blue', '#FCFF00' + * + * @member {string|number} + */ + get: function () { + return this._stroke; + }, + set: function (stroke) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var outputColor = getColor(stroke); + if (this._stroke !== outputColor) { + this._stroke = outputColor; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "strokeThickness", { + /** + * A number that represents the thickness of the stroke. + * Default is 0 (no stroke) + * + * @member {number} + */ + get: function () { + return this._strokeThickness; + }, + set: function (strokeThickness) { + if (this._strokeThickness !== strokeThickness) { + this._strokeThickness = strokeThickness; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "textBaseline", { + /** + * The baseline of the text that is rendered. + * + * @member {string} + */ + get: function () { + return this._textBaseline; + }, + set: function (textBaseline) { + if (this._textBaseline !== textBaseline) { + this._textBaseline = textBaseline; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "trim", { + /** + * Trim transparent borders + * + * @member {boolean} + */ + get: function () { + return this._trim; + }, + set: function (trim) { + if (this._trim !== trim) { + this._trim = trim; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "whiteSpace", { + /** + * How newlines and spaces should be handled. + * Default is 'pre' (preserve, preserve). + * + * value | New lines | Spaces + * --- | --- | --- + * 'normal' | Collapse | Collapse + * 'pre' | Preserve | Preserve + * 'pre-line' | Preserve | Collapse + * + * @member {string} + */ + get: function () { + return this._whiteSpace; + }, + set: function (whiteSpace) { + if (this._whiteSpace !== whiteSpace) { + this._whiteSpace = whiteSpace; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "wordWrap", { + /** + * Indicates if word wrap should be used + * + * @member {boolean} + */ + get: function () { + return this._wordWrap; + }, + set: function (wordWrap) { + if (this._wordWrap !== wordWrap) { + this._wordWrap = wordWrap; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextStyle.prototype, "wordWrapWidth", { + /** + * The width at which text will wrap, it needs wordWrap to be set to true + * + * @member {number} + */ + get: function () { + return this._wordWrapWidth; + }, + set: function (wordWrapWidth) { + if (this._wordWrapWidth !== wordWrapWidth) { + this._wordWrapWidth = wordWrapWidth; + this.styleID++; + } + }, + enumerable: false, + configurable: true + }); + /** + * Generates a font style string to use for `TextMetrics.measureFont()`. + * + * @return {string} Font style string, for passing to `TextMetrics.measureFont()` + */ + TextStyle.prototype.toFontString = function () { + // build canvas api font setting from individual components. Convert a numeric this.fontSize to px + var fontSizeString = (typeof this.fontSize === 'number') ? this.fontSize + "px" : this.fontSize; + // Clean-up fontFamily property by quoting each font name + // this will support font names with spaces + var fontFamilies = this.fontFamily; + if (!Array.isArray(this.fontFamily)) { + fontFamilies = this.fontFamily.split(','); } - fontFamilies[i] = fontFamily; - } - - return ((this.fontStyle) + " " + (this.fontVariant) + " " + (this.fontWeight) + " " + fontSizeString + " " + (fontFamilies.join(','))); - }; - - Object.defineProperties( TextStyle.prototype, prototypeAccessors$7 ); - + for (var i = fontFamilies.length - 1; i >= 0; i--) { + // Trim any extra white-space + var fontFamily = fontFamilies[i].trim(); + // Check if font already contains strings + if (!(/([\"\'])[^\'\"]+\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0) { + fontFamily = "\"" + fontFamily + "\""; + } + fontFamilies[i] = fontFamily; + } + return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + fontSizeString + " " + fontFamilies.join(','); + }; + return TextStyle; + }()); /** * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. * @private - * @param {number|number[]} color + * @param {string|number} color * @return {string} The color as a string. */ - function getSingleColor(color) - { - if (typeof color === 'number') - { + function getSingleColor(color) { + if (typeof color === 'number') { return hex2string(color); } - else if ( typeof color === 'string' ) - { - if ( color.indexOf('0x') === 0 ) - { + else if (typeof color === 'string') { + if (color.indexOf('0x') === 0) { color = color.replace('0x', '#'); } } - return color; } - - /** - * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. - * This version can also convert array of colors - * @private - * @param {number|number[]} color - * @return {string} The color as a string. - */ - function getColor(color) - { - if (!Array.isArray(color)) - { + function getColor(color) { + if (!Array.isArray(color)) { return getSingleColor(color); } - else - { - for (var i = 0; i < color.length; ++i) - { + else { + for (var i = 0; i < color.length; ++i) { color[i] = getSingleColor(color[i]); } - return color; } } - /** * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string. * This version can also convert array of colors * @private - * @param {Array} array1 First array to compare - * @param {Array} array2 Second array to compare + * @param {Array} array1 - First array to compare + * @param {Array} array2 - Second array to compare * @return {boolean} Do the arrays contain the same values in the same order */ - function areArraysEqual(array1, array2) - { - if (!Array.isArray(array1) || !Array.isArray(array2)) - { + function areArraysEqual(array1, array2) { + if (!Array.isArray(array1) || !Array.isArray(array2)) { return false; } - - if (array1.length !== array2.length) - { + if (array1.length !== array2.length) { return false; } - - for (var i = 0; i < array1.length; ++i) - { - if (array1[i] !== array2[i]) - { + for (var i = 0; i < array1.length; ++i) { + if (array1[i] !== array2[i]) { return false; } } - return true; } - /** * Utility function to ensure that object properties are copied by value, and not by reference * @private - * @param {Object} target Target object to copy properties into - * @param {Object} source Source object for the properties to copy - * @param {string} propertyObj Object containing properties names we want to loop over + * @param {Object} target - Target object to copy properties into + * @param {Object} source - Source object for the properties to copy + * @param {string} propertyObj - Object containing properties names we want to loop over */ function deepCopyProperties(target, source, propertyObj) { for (var prop in propertyObj) { if (Array.isArray(source[prop])) { target[prop] = source[prop].slice(); - } else { + } + else { target[prop] = source[prop]; } } @@ -39941,699 +36283,535 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var TextMetrics = function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) - { + var TextMetrics = /** @class */ (function () { /** - * The text that was measured - * - * @member {string} + * @param {string} text - the text that was measured + * @param {PIXI.TextStyle} style - the style that was measured + * @param {number} width - the measured width of the text + * @param {number} height - the measured height of the text + * @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style + * @param {number[]} lineWidths - an array of the line widths for each line matched to `lines` + * @param {number} lineHeight - the measured line height for this style + * @param {number} maxLineWidth - the maximum line width for all measured lines + * @param {Object} fontProperties - the font properties object from TextMetrics.measureFont */ - this.text = text; - - /** - * The style that was measured - * - * @member {PIXI.TextStyle} - */ - this.style = style; - - /** - * The measured width of the text - * - * @member {number} - */ - this.width = width; - - /** - * The measured height of the text - * - * @member {number} - */ - this.height = height; - - /** - * An array of lines of the text broken by new lines and wrapping is specified in style - * - * @member {string[]} - */ - this.lines = lines; - - /** - * An array of the line widths for each line matched to `lines` - * - * @member {number[]} - */ - this.lineWidths = lineWidths; - - /** - * The measured line height for this style - * - * @member {number} - */ - this.lineHeight = lineHeight; - - /** - * The maximum line width for all measured lines - * - * @member {number} - */ - this.maxLineWidth = maxLineWidth; - - /** - * The font properties object from TextMetrics.measureFont - * - * @member {PIXI.IFontMetrics} - */ - this.fontProperties = fontProperties; - }; - - /** - * Measures the supplied string of text and returns a Rectangle. - * - * @param {string} text - the text to measure. - * @param {PIXI.TextStyle} style - the text style to use for measuring - * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {PIXI.TextMetrics} measured width and height of the text. - */ - TextMetrics.measureText = function measureText (text, style, wordWrap, canvas) - { - if ( canvas === void 0 ) { canvas = TextMetrics._canvas; } - - wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap; - var font = style.toFontString(); - var fontProperties = TextMetrics.measureFont(font); - - // fallback in case UA disallow canvas data extraction - // (toDataURI, getImageData functions) - if (fontProperties.fontSize === 0) - { - fontProperties.fontSize = style.fontSize; - fontProperties.ascent = style.fontSize; + function TextMetrics(text, style, width, height, lines, lineWidths, lineHeight, maxLineWidth, fontProperties) { + /** + * The text that was measured + * + * @member {string} + */ + this.text = text; + /** + * The style that was measured + * + * @member {PIXI.TextStyle} + */ + this.style = style; + /** + * The measured width of the text + * + * @member {number} + */ + this.width = width; + /** + * The measured height of the text + * + * @member {number} + */ + this.height = height; + /** + * An array of lines of the text broken by new lines and wrapping is specified in style + * + * @member {string[]} + */ + this.lines = lines; + /** + * An array of the line widths for each line matched to `lines` + * + * @member {number[]} + */ + this.lineWidths = lineWidths; + /** + * The measured line height for this style + * + * @member {number} + */ + this.lineHeight = lineHeight; + /** + * The maximum line width for all measured lines + * + * @member {number} + */ + this.maxLineWidth = maxLineWidth; + /** + * The font properties object from TextMetrics.measureFont + * + * @member {PIXI.IFontMetrics} + */ + this.fontProperties = fontProperties; } - - var context = canvas.getContext('2d'); - - context.font = font; - - var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; - var lines = outputText.split(/(?:\r\n|\r|\n)/); - var lineWidths = new Array(lines.length); - var maxLineWidth = 0; - - for (var i = 0; i < lines.length; i++) - { - var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing); - - lineWidths[i] = lineWidth; - maxLineWidth = Math.max(maxLineWidth, lineWidth); - } - var width = maxLineWidth + style.strokeThickness; - - if (style.dropShadow) - { - width += style.dropShadowDistance; - } - - var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; - var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) - + ((lines.length - 1) * (lineHeight + style.leading)); - - if (style.dropShadow) - { - height += style.dropShadowDistance; - } - - return new TextMetrics( - text, - style, - width, - height, - lines, - lineWidths, - lineHeight + style.leading, - maxLineWidth, - fontProperties - ); - }; - - /** - * Applies newlines to a string to have it optimally fit into the horizontal - * bounds set by the Text object's wordWrapWidth property. - * - * @private - * @param {string} text - String to apply word wrapping to - * @param {PIXI.TextStyle} style - the style to use when wrapping - * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. - * @return {string} New string with new lines applied where required - */ - TextMetrics.wordWrap = function wordWrap (text, style, canvas) - { - if ( canvas === void 0 ) { canvas = TextMetrics._canvas; } - - var context = canvas.getContext('2d'); - - var width = 0; - var line = ''; - var lines = ''; - - var cache = {}; - var letterSpacing = style.letterSpacing; - var whiteSpace = style.whiteSpace; - - // How to handle whitespaces - var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); - var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); - - // whether or not spaces may be added to the beginning of lines - var canPrependSpaces = !collapseSpaces; - - // There is letterSpacing after every char except the last one - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! - // so for convenience the above needs to be compared to width + 1 extra letterSpace - // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ - // ________________________________________________ - // And then the final space is simply no appended to each line - var wordWrapWidth = style.wordWrapWidth + letterSpacing; - - // break text into words, spaces and newline chars - var tokens = TextMetrics.tokenize(text); - - for (var i = 0; i < tokens.length; i++) - { - // get the word, space or newlineChar - var token = tokens[i]; - - // if word is a new line - if (TextMetrics.isNewline(token)) - { - // keep the new line - if (!collapseNewlines) - { - lines += TextMetrics.addLine(line); - canPrependSpaces = !collapseSpaces; - line = ''; - width = 0; - continue; - } - - // if we should collapse new lines - // we simply convert it into a space - token = ' '; + /** + * Measures the supplied string of text and returns a Rectangle. + * + * @param {string} text - the text to measure. + * @param {PIXI.TextStyle} style - the text style to use for measuring + * @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text. + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {PIXI.TextMetrics} measured width and height of the text. + */ + TextMetrics.measureText = function (text, style, wordWrap, canvas) { + if (canvas === void 0) { canvas = TextMetrics._canvas; } + wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap; + var font = style.toFontString(); + var fontProperties = TextMetrics.measureFont(font); + // fallback in case UA disallow canvas data extraction + // (toDataURI, getImageData functions) + if (fontProperties.fontSize === 0) { + fontProperties.fontSize = style.fontSize; + fontProperties.ascent = style.fontSize; } - - // if we should collapse repeated whitespaces - if (collapseSpaces) - { - // check both this and the last tokens for spaces - var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); - var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); - - if (currIsBreakingSpace && lastIsBreakingSpace) - { - continue; - } + var context = canvas.getContext('2d'); + context.font = font; + var outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text; + var lines = outputText.split(/(?:\r\n|\r|\n)/); + var lineWidths = new Array(lines.length); + var maxLineWidth = 0; + for (var i = 0; i < lines.length; i++) { + var lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing); + lineWidths[i] = lineWidth; + maxLineWidth = Math.max(maxLineWidth, lineWidth); } - - // get word width from cache if possible - var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); - - // word is longer than desired bounds - if (tokenWidth > wordWrapWidth) - { - // if we are not already at the beginning of a line - if (line !== '') - { - // start newlines for overflow words - lines += TextMetrics.addLine(line); - line = ''; - width = 0; + var width = maxLineWidth + style.strokeThickness; + if (style.dropShadow) { + width += style.dropShadowDistance; + } + var lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness; + var height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness) + + ((lines.length - 1) * (lineHeight + style.leading)); + if (style.dropShadow) { + height += style.dropShadowDistance; + } + return new TextMetrics(text, style, width, height, lines, lineWidths, lineHeight + style.leading, maxLineWidth, fontProperties); + }; + /** + * Applies newlines to a string to have it optimally fit into the horizontal + * bounds set by the Text object's wordWrapWidth property. + * + * @private + * @param {string} text - String to apply word wrapping to + * @param {PIXI.TextStyle} style - the style to use when wrapping + * @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring. + * @return {string} New string with new lines applied where required + */ + TextMetrics.wordWrap = function (text, style, canvas) { + if (canvas === void 0) { canvas = TextMetrics._canvas; } + var context = canvas.getContext('2d'); + var width = 0; + var line = ''; + var lines = ''; + var cache = {}; + var letterSpacing = style.letterSpacing, whiteSpace = style.whiteSpace; + // How to handle whitespaces + var collapseSpaces = TextMetrics.collapseSpaces(whiteSpace); + var collapseNewlines = TextMetrics.collapseNewlines(whiteSpace); + // whether or not spaces may be added to the beginning of lines + var canPrependSpaces = !collapseSpaces; + // There is letterSpacing after every char except the last one + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_! + // so for convenience the above needs to be compared to width + 1 extra letterSpace + // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_ + // ________________________________________________ + // And then the final space is simply no appended to each line + var wordWrapWidth = style.wordWrapWidth + letterSpacing; + // break text into words, spaces and newline chars + var tokens = TextMetrics.tokenize(text); + for (var i = 0; i < tokens.length; i++) { + // get the word, space or newlineChar + var token = tokens[i]; + // if word is a new line + if (TextMetrics.isNewline(token)) { + // keep the new line + if (!collapseNewlines) { + lines += TextMetrics.addLine(line); + canPrependSpaces = !collapseSpaces; + line = ''; + width = 0; + continue; + } + // if we should collapse new lines + // we simply convert it into a space + token = ' '; } - - // break large word over multiple lines - if (TextMetrics.canBreakWords(token, style.breakWords)) - { - // break word into characters - var characters = TextMetrics.wordWrapSplit(token); - - // loop the characters - for (var j = 0; j < characters.length; j++) - { - var char = characters[j]; - - var k = 1; - // we are not at the end of the token - - while (characters[j + k]) - { - var nextChar = characters[j + k]; - var lastChar = char[char.length - 1]; - - // should not split chars - if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) - { - // combine chars & move forward one - char += nextChar; - } - else - { - break; - } - - k++; - } - - j += char.length - 1; - - var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); - - if (characterWidth + width > wordWrapWidth) - { - lines += TextMetrics.addLine(line); - canPrependSpaces = false; - line = ''; - width = 0; - } - - line += char; - width += characterWidth; + // if we should collapse repeated whitespaces + if (collapseSpaces) { + // check both this and the last tokens for spaces + var currIsBreakingSpace = TextMetrics.isBreakingSpace(token); + var lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]); + if (currIsBreakingSpace && lastIsBreakingSpace) { + continue; } } - - // run word out of the bounds - else - { - // if there are words in this line already - // finish that line and start a new one - if (line.length > 0) - { + // get word width from cache if possible + var tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context); + // word is longer than desired bounds + if (tokenWidth > wordWrapWidth) { + // if we are not already at the beginning of a line + if (line !== '') { + // start newlines for overflow words lines += TextMetrics.addLine(line); line = ''; width = 0; } - - var isLastToken = i === tokens.length - 1; - - // give it its own line if it's not the end - lines += TextMetrics.addLine(token, !isLastToken); - canPrependSpaces = false; - line = ''; - width = 0; + // break large word over multiple lines + if (TextMetrics.canBreakWords(token, style.breakWords)) { + // break word into characters + var characters = TextMetrics.wordWrapSplit(token); + // loop the characters + for (var j = 0; j < characters.length; j++) { + var char = characters[j]; + var k = 1; + // we are not at the end of the token + while (characters[j + k]) { + var nextChar = characters[j + k]; + var lastChar = char[char.length - 1]; + // should not split chars + if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords)) { + // combine chars & move forward one + char += nextChar; + } + else { + break; + } + k++; + } + j += char.length - 1; + var characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context); + if (characterWidth + width > wordWrapWidth) { + lines += TextMetrics.addLine(line); + canPrependSpaces = false; + line = ''; + width = 0; + } + line += char; + width += characterWidth; + } + } + // run word out of the bounds + else { + // if there are words in this line already + // finish that line and start a new one + if (line.length > 0) { + lines += TextMetrics.addLine(line); + line = ''; + width = 0; + } + var isLastToken = i === tokens.length - 1; + // give it its own line if it's not the end + lines += TextMetrics.addLine(token, !isLastToken); + canPrependSpaces = false; + line = ''; + width = 0; + } } - } - - // word could fit - else - { - // word won't fit because of existing words - // start a new line - if (tokenWidth + width > wordWrapWidth) - { - // if its a space we don't want it - canPrependSpaces = false; - - // add a new line - lines += TextMetrics.addLine(line); - + // word could fit + else { + // word won't fit because of existing words // start a new line - line = ''; - width = 0; - } - - // don't add spaces to the beginning of lines - if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) - { - // add the word to the current line - line += token; - - // update width counter - width += tokenWidth; + if (tokenWidth + width > wordWrapWidth) { + // if its a space we don't want it + canPrependSpaces = false; + // add a new line + lines += TextMetrics.addLine(line); + // start a new line + line = ''; + width = 0; + } + // don't add spaces to the beginning of lines + if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces) { + // add the word to the current line + line += token; + // update width counter + width += tokenWidth; + } } } - } - - lines += TextMetrics.addLine(line, false); - - return lines; - }; - - /** - * Convienience function for logging each line added during the wordWrap - * method - * - * @private - * @param {string} line - The line of text to add - * @param {boolean} newLine - Add new line character to end - * @return {string} A formatted line - */ - TextMetrics.addLine = function addLine (line, newLine) - { - if ( newLine === void 0 ) { newLine = true; } - - line = TextMetrics.trimRight(line); - - line = (newLine) ? (line + "\n") : line; - - return line; - }; - - /** - * Gets & sets the widths of calculated characters in a cache object - * - * @private - * @param {string} key The key - * @param {number} letterSpacing The letter spacing - * @param {object} cache The cache - * @param {CanvasRenderingContext2D} context The canvas context - * @return {number} The from cache. - */ - TextMetrics.getFromCache = function getFromCache (key, letterSpacing, cache, context) - { - var width = cache[key]; - - if (width === undefined) - { - var spacing = ((key.length) * letterSpacing); - - width = context.measureText(key).width + spacing; - cache[key] = width; - } - - return width; - }; - - /** - * Determines whether we should collapse breaking spaces - * - * @private - * @param {string} whiteSpace The TextStyle property whiteSpace - * @return {boolean} should collapse - */ - TextMetrics.collapseSpaces = function collapseSpaces (whiteSpace) - { - return (whiteSpace === 'normal' || whiteSpace === 'pre-line'); - }; - - /** - * Determines whether we should collapse newLine chars - * - * @private - * @param {string} whiteSpace The white space - * @return {boolean} should collapse - */ - TextMetrics.collapseNewlines = function collapseNewlines (whiteSpace) - { - return (whiteSpace === 'normal'); - }; - - /** - * trims breaking whitespaces from string - * - * @private - * @param {string} text The text - * @return {string} trimmed string - */ - TextMetrics.trimRight = function trimRight (text) - { - if (typeof text !== 'string') - { - return ''; - } - - for (var i = text.length - 1; i >= 0; i--) - { - var char = text[i]; - - if (!TextMetrics.isBreakingSpace(char)) - { - break; + lines += TextMetrics.addLine(line, false); + return lines; + }; + /** + * Convienience function for logging each line added during the wordWrap + * method + * + * @private + * @param {string} line - The line of text to add + * @param {boolean} newLine - Add new line character to end + * @return {string} A formatted line + */ + TextMetrics.addLine = function (line, newLine) { + if (newLine === void 0) { newLine = true; } + line = TextMetrics.trimRight(line); + line = (newLine) ? line + "\n" : line; + return line; + }; + /** + * Gets & sets the widths of calculated characters in a cache object + * + * @private + * @param {string} key - The key + * @param {number} letterSpacing - The letter spacing + * @param {object} cache - The cache + * @param {CanvasRenderingContext2D} context - The canvas context + * @return {number} The from cache. + */ + TextMetrics.getFromCache = function (key, letterSpacing, cache, context) { + var width = cache[key]; + if (width === undefined) { + var spacing = ((key.length) * letterSpacing); + width = context.measureText(key).width + spacing; + cache[key] = width; + } + return width; + }; + /** + * Determines whether we should collapse breaking spaces + * + * @private + * @param {string} whiteSpace - The TextStyle property whiteSpace + * @return {boolean} should collapse + */ + TextMetrics.collapseSpaces = function (whiteSpace) { + return (whiteSpace === 'normal' || whiteSpace === 'pre-line'); + }; + /** + * Determines whether we should collapse newLine chars + * + * @private + * @param {string} whiteSpace - The white space + * @return {boolean} should collapse + */ + TextMetrics.collapseNewlines = function (whiteSpace) { + return (whiteSpace === 'normal'); + }; + /** + * trims breaking whitespaces from string + * + * @private + * @param {string} text - The text + * @return {string} trimmed string + */ + TextMetrics.trimRight = function (text) { + if (typeof text !== 'string') { + return ''; + } + for (var i = text.length - 1; i >= 0; i--) { + var char = text[i]; + if (!TextMetrics.isBreakingSpace(char)) { + break; + } + text = text.slice(0, -1); + } + return text; + }; + /** + * Determines if char is a newline. + * + * @private + * @param {string} char - The character + * @return {boolean} True if newline, False otherwise. + */ + TextMetrics.isNewline = function (char) { + if (typeof char !== 'string') { + return false; + } + return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0); + }; + /** + * Determines if char is a breaking whitespace. + * + * @private + * @param {string} char - The character + * @return {boolean} True if whitespace, False otherwise. + */ + TextMetrics.isBreakingSpace = function (char) { + if (typeof char !== 'string') { + return false; + } + return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0); + }; + /** + * Splits a string into words, breaking-spaces and newLine characters + * + * @private + * @param {string} text - The text + * @return {string[]} A tokenized array + */ + TextMetrics.tokenize = function (text) { + var tokens = []; + var token = ''; + if (typeof text !== 'string') { + return tokens; + } + for (var i = 0; i < text.length; i++) { + var char = text[i]; + if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) { + if (token !== '') { + tokens.push(token); + token = ''; + } + tokens.push(char); + continue; + } + token += char; + } + if (token !== '') { + tokens.push(token); } - - text = text.slice(0, -1); - } - - return text; - }; - - /** - * Determines if char is a newline. - * - * @private - * @param {string} char The character - * @return {boolean} True if newline, False otherwise. - */ - TextMetrics.isNewline = function isNewline (char) - { - if (typeof char !== 'string') - { - return false; - } - - return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0); - }; - - /** - * Determines if char is a breaking whitespace. - * - * @private - * @param {string} char The character - * @return {boolean} True if whitespace, False otherwise. - */ - TextMetrics.isBreakingSpace = function isBreakingSpace (char) - { - if (typeof char !== 'string') - { - return false; - } - - return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0); - }; - - /** - * Splits a string into words, breaking-spaces and newLine characters - * - * @private - * @param {string} text The text - * @return {string[]} A tokenized array - */ - TextMetrics.tokenize = function tokenize (text) - { - var tokens = []; - var token = ''; - - if (typeof text !== 'string') - { return tokens; - } - - for (var i = 0; i < text.length; i++) - { - var char = text[i]; - - if (TextMetrics.isBreakingSpace(char) || TextMetrics.isNewline(char)) - { - if (token !== '') - { - tokens.push(token); - token = ''; - } - - tokens.push(char); - - continue; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It allows one to customise which words should break + * Examples are if the token is CJK or numbers. + * It must return a boolean. + * + * @param {string} token - The token + * @param {boolean} breakWords - The style attr break words + * @return {boolean} whether to break word or not + */ + TextMetrics.canBreakWords = function (_token, breakWords) { + return breakWords; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It allows one to determine whether a pair of characters + * should be broken by newlines + * For example certain characters in CJK langs or numbers. + * It must return a boolean. + * + * @param {string} char - The character + * @param {string} nextChar - The next character + * @param {string} token - The token/word the characters are from + * @param {number} index - The index in the token of the char + * @param {boolean} breakWords - The style attr break words + * @return {boolean} whether to break word or not + */ + TextMetrics.canBreakChars = function (_char, _nextChar, _token, _index, _breakWords) { + return true; + }; + /** + * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. + * + * It is called when a token (usually a word) has to be split into separate pieces + * in order to determine the point to break a word. + * It must return an array of characters. + * + * @example + * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. + * TextMetrics.wordWrapSplit = (token) => [...token]; + * + * @param {string} token - The token to split + * @return {string[]} The characters of the token + */ + TextMetrics.wordWrapSplit = function (token) { + return token.split(''); + }; + /** + * Calculates the ascent, descent and fontSize of a given font-style + * + * @static + * @param {string} font - String representing the style of the font + * @return {PIXI.IFontMetrics} Font properties object + */ + TextMetrics.measureFont = function (font) { + // as this method is used for preparing assets, don't recalculate things if we don't need to + if (TextMetrics._fonts[font]) { + return TextMetrics._fonts[font]; } - - token += char; - } - - if (token !== '') - { - tokens.push(token); - } - - return tokens; - }; - - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to customise which words should break - * Examples are if the token is CJK or numbers. - * It must return a boolean. - * - * @param {string} token The token - * @param {boolean} breakWords The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakWords = function canBreakWords (token, breakWords) - { - return breakWords; - }; - - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It allows one to determine whether a pair of characters - * should be broken by newlines - * For example certain characters in CJK langs or numbers. - * It must return a boolean. - * - * @param {string} char The character - * @param {string} nextChar The next character - * @param {string} token The token/word the characters are from - * @param {number} index The index in the token of the char - * @param {boolean} breakWords The style attr break words - * @return {boolean} whether to break word or not - */ - TextMetrics.canBreakChars = function canBreakChars (char, nextChar, token, index, breakWords) // eslint-disable-line no-unused-vars - { - return true; - }; - - /** - * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior. - * - * It is called when a token (usually a word) has to be split into separate pieces - * in order to determine the point to break a word. - * It must return an array of characters. - * - * @example - * // Correctly splits emojis, eg "🤪🤪" will result in two element array, each with one emoji. - * TextMetrics.wordWrapSplit = (token) => [...token]; - * - * @param {string} token The token to split - * @return {string[]} The characters of the token - */ - TextMetrics.wordWrapSplit = function wordWrapSplit (token) - { - return token.split(''); - }; - - /** - * Calculates the ascent, descent and fontSize of a given font-style - * - * @static - * @param {string} font - String representing the style of the font - * @return {PIXI.IFontMetrics} Font properties object - */ - TextMetrics.measureFont = function measureFont (font) - { - // as this method is used for preparing assets, don't recalculate things if we don't need to - if (TextMetrics._fonts[font]) - { - return TextMetrics._fonts[font]; - } - - var properties = {}; - - var canvas = TextMetrics._canvas; - var context = TextMetrics._context; - - context.font = font; - - var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; - var width = Math.ceil(context.measureText(metricsString).width); - var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); - var height = 2 * baseline; - - baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; - - canvas.width = width; - canvas.height = height; - - context.fillStyle = '#f00'; - context.fillRect(0, 0, width, height); - - context.font = font; - - context.textBaseline = 'alphabetic'; - context.fillStyle = '#000'; - context.fillText(metricsString, 0, baseline); - - var imagedata = context.getImageData(0, 0, width, height).data; - var pixels = imagedata.length; - var line = width * 4; - - var i = 0; - var idx = 0; - var stop = false; - - // ascent. scan from top to bottom until we find a non red pixel - for (i = 0; i < baseline; ++i) - { - for (var j = 0; j < line; j += 4) - { - if (imagedata[idx + j] !== 255) - { - stop = true; + var properties = { + ascent: 0, + descent: 0, + fontSize: 0, + }; + var canvas = TextMetrics._canvas; + var context = TextMetrics._context; + context.font = font; + var metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL; + var width = Math.ceil(context.measureText(metricsString).width); + var baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width); + var height = 2 * baseline; + baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0; + canvas.width = width; + canvas.height = height; + context.fillStyle = '#f00'; + context.fillRect(0, 0, width, height); + context.font = font; + context.textBaseline = 'alphabetic'; + context.fillStyle = '#000'; + context.fillText(metricsString, 0, baseline); + var imagedata = context.getImageData(0, 0, width, height).data; + var pixels = imagedata.length; + var line = width * 4; + var i = 0; + var idx = 0; + var stop = false; + // ascent. scan from top to bottom until we find a non red pixel + for (i = 0; i < baseline; ++i) { + for (var j = 0; j < line; j += 4) { + if (imagedata[idx + j] !== 255) { + stop = true; + break; + } + } + if (!stop) { + idx += line; + } + else { break; } } - if (!stop) - { - idx += line; - } - else - { - break; - } - } - - properties.ascent = baseline - i; - - idx = pixels - line; - stop = false; - - // descent. scan from bottom to top until we find a non red pixel - for (i = height; i > baseline; --i) - { - for (var j$1 = 0; j$1 < line; j$1 += 4) - { - if (imagedata[idx + j$1] !== 255) - { - stop = true; + properties.ascent = baseline - i; + idx = pixels - line; + stop = false; + // descent. scan from bottom to top until we find a non red pixel + for (i = height; i > baseline; --i) { + for (var j = 0; j < line; j += 4) { + if (imagedata[idx + j] !== 255) { + stop = true; + break; + } + } + if (!stop) { + idx -= line; + } + else { break; } } - - if (!stop) - { - idx -= line; + properties.descent = i - baseline; + properties.fontSize = properties.ascent + properties.descent; + TextMetrics._fonts[font] = properties; + return properties; + }; + /** + * Clear font metrics in metrics cache. + * + * @static + * @param {string} [font] - font name. If font name not set then clear cache for all fonts. + */ + TextMetrics.clearMetrics = function (font) { + if (font === void 0) { font = ''; } + if (font) { + delete TextMetrics._fonts[font]; } - else - { - break; + else { + TextMetrics._fonts = {}; } - } - - properties.descent = i - baseline; - properties.fontSize = properties.ascent + properties.descent; - - TextMetrics._fonts[font] = properties; - - return properties; - }; - - /** - * Clear font metrics in metrics cache. - * - * @static - * @param {string} [font] - font name. If font name not set then clear cache for all fonts. - */ - TextMetrics.clearMetrics = function clearMetrics (font) - { - if ( font === void 0 ) { font = ''; } - - if (font) - { - delete TextMetrics._fonts[font]; - } - else - { - TextMetrics._fonts = {}; - } - }; - + }; + return TextMetrics; + }()); /** * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}. * @@ -40644,29 +36822,21 @@ var PIXI = (function (exports) { * @memberof PIXI.TextMetrics * @private */ - var canvas = (function () { - try - { + try { // OffscreenCanvas2D measureText can be up to 40% faster. var c = new OffscreenCanvas(0, 0); var context = c.getContext('2d'); - - if (context && context.measureText) - { + if (context && context.measureText) { return c; } - return document.createElement('canvas'); } - catch (ex) - { + catch (ex) { return document.createElement('canvas'); } })(); - canvas.width = canvas.height = 10; - /** * Cached canvas element for measuring text * @@ -40675,7 +36845,6 @@ var PIXI = (function (exports) { * @private */ TextMetrics._canvas = canvas; - /** * Cache for context to use. * @@ -40684,7 +36853,6 @@ var PIXI = (function (exports) { * @private */ TextMetrics._context = canvas.getContext('2d'); - /** * Cache of {@see PIXI.TextMetrics.FontMetrics} objects. * @@ -40693,7 +36861,6 @@ var PIXI = (function (exports) { * @private */ TextMetrics._fonts = {}; - /** * String used for calculate font metrics. * These characters are all tall to help calculate the height required for text. @@ -40705,7 +36872,6 @@ var PIXI = (function (exports) { * @default |ÉqÅ */ TextMetrics.METRICS_STRING = '|ÉqÅ'; - /** * Baseline symbol for calculate font metrics. * @@ -40716,7 +36882,6 @@ var PIXI = (function (exports) { * @default M */ TextMetrics.BASELINE_SYMBOL = 'M'; - /** * Baseline multiplier for calculate font metrics. * @@ -40727,7 +36892,6 @@ var PIXI = (function (exports) { * @default 1.4 */ TextMetrics.BASELINE_MULTIPLIER = 1.4; - /** * Cache of new line chars. * @@ -40736,9 +36900,8 @@ var PIXI = (function (exports) { * @private */ TextMetrics._newlines = [ - 0x000A, // line feed + 0x000A, 0x000D ]; - /** * Cache of breaking spaces. * @@ -40747,21 +36910,20 @@ var PIXI = (function (exports) { * @private */ TextMetrics._breakingSpaces = [ - 0x0009, // character tabulation - 0x0020, // space - 0x2000, // en quad - 0x2001, // em quad - 0x2002, // en space - 0x2003, // em space - 0x2004, // three-per-em space - 0x2005, // four-per-em space - 0x2006, // six-per-em space - 0x2008, // punctuation space - 0x2009, // thin space - 0x200A, // hair space - 0x205F, // medium mathematical space + 0x0009, + 0x0020, + 0x2000, + 0x2001, + 0x2002, + 0x2003, + 0x2004, + 0x2005, + 0x2006, + 0x2008, + 0x2009, + 0x200A, + 0x205F, 0x3000 ]; - /** * A number, or a string containing a number. * @@ -40772,14 +36934,11 @@ var PIXI = (function (exports) { * @property {number} fontSize - Font size */ - /* eslint max-depth: [2, 8] */ - var defaultDestroyOptions = { texture: true, children: false, baseTexture: true, }; - /** * A Text Object will create a line or multiple lines of text. * @@ -40805,110 +36964,107 @@ var PIXI = (function (exports) { * @extends PIXI.Sprite * @memberof PIXI */ - var Text = /*@__PURE__*/(function (Sprite) { - function Text(text, style, canvas) - { - canvas = canvas || document.createElement('canvas'); - + var Text = /** @class */ (function (_super) { + __extends$7(Text, _super); + /** + * @param {string} text - The string that you would like the text to display + * @param {object|PIXI.TextStyle} [style] - The style parameters + * @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text + */ + function Text(text, style, canvas) { + var _this = this; + var ownCanvas = false; + if (!canvas) { + canvas = document.createElement('canvas'); + ownCanvas = true; + } canvas.width = 3; canvas.height = 3; - var texture = Texture.from(canvas); - texture.orig = new Rectangle(); texture.trim = new Rectangle(); - - Sprite.call(this, texture); - + _this = _super.call(this, texture) || this; + /** + * Keep track if this Text object created it's own canvas + * element (`true`) or uses the constructor argument (`false`). + * Used to workaround a GC issues with Safari < 13 when + * destroying Text. See `destroy` for more info. + * + * @member {boolean} + * @private + */ + _this._ownCanvas = ownCanvas; /** * The canvas element that everything is drawn to * * @member {HTMLCanvasElement} */ - this.canvas = canvas; - + _this.canvas = canvas; /** * The canvas 2d context that everything is drawn with * @member {CanvasRenderingContext2D} */ - this.context = this.canvas.getContext('2d'); - + _this.context = _this.canvas.getContext('2d'); /** * The resolution / device pixel ratio of the canvas. * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. * @member {number} * @default 1 */ - this._resolution = settings.RESOLUTION; - this._autoResolution = true; - + _this._resolution = settings.RESOLUTION; + _this._autoResolution = true; /** * Private tracker for the current text. * * @member {string} * @private */ - this._text = null; - + _this._text = null; /** * Private tracker for the current style. * * @member {object} * @private */ - this._style = null; + _this._style = null; /** * Private listener to track style changes. * * @member {Function} * @private */ - this._styleListener = null; - + _this._styleListener = null; /** * Private tracker for the current font. * * @member {string} * @private */ - this._font = ''; - - this.text = text; - this.style = style; - - this.localStyleID = -1; + _this._font = ''; + _this.text = text; + _this.style = style; + _this.localStyleID = -1; + return _this; } - - if ( Sprite ) { Text.__proto__ = Sprite; } - Text.prototype = Object.create( Sprite && Sprite.prototype ); - Text.prototype.constructor = Text; - - var prototypeAccessors = { width: { configurable: true },height: { configurable: true },style: { configurable: true },text: { configurable: true },resolution: { configurable: true } }; - /** - * Renders text and updates it when needed. + * Renders text to its canvas, and updates its texture. + * By default this is used internally to ensure the texture is correct before rendering, + * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text, + * and then shared across multiple Sprites. * - * @private * @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called. */ - Text.prototype.updateText = function updateText (respectDirty) - { + Text.prototype.updateText = function (respectDirty) { var style = this._style; - // check if style has changed.. - if (this.localStyleID !== style.styleID) - { + if (this.localStyleID !== style.styleID) { this.dirty = true; this.localStyleID = style.styleID; } - - if (!this.dirty && respectDirty) - { + if (!this.dirty && respectDirty) { return; } - this._font = this._style.toFontString(); - var context = this.context; var measured = TextMetrics.measureText(this._text || ' ', this._style, this._style.wordWrap, this.canvas); var width = measured.width; @@ -40918,26 +37074,19 @@ var PIXI = (function (exports) { var lineWidths = measured.lineWidths; var maxLineWidth = measured.maxLineWidth; var fontProperties = measured.fontProperties; - this.canvas.width = Math.ceil((Math.max(1, width) + (style.padding * 2)) * this._resolution); this.canvas.height = Math.ceil((Math.max(1, height) + (style.padding * 2)) * this._resolution); - context.scale(this._resolution, this._resolution); - context.clearRect(0, 0, this.canvas.width, this.canvas.height); - context.font = this._font; context.lineWidth = style.strokeThickness; context.textBaseline = style.textBaseline; context.lineJoin = style.lineJoin; context.miterLimit = style.miterLimit; - var linePositionX; var linePositionY; - // require 2 passes if a shadow; the first to draw the drop shadow, the second to draw the text var passesCount = style.dropShadow ? 2 : 1; - // For v4, we drew text at the colours of the drop shadow underneath the normal text. This gave the correct zIndex, // but features such as alpha and shadowblur did not look right at all, since we were using actual text as a shadow. // @@ -40949,79 +37098,55 @@ var PIXI = (function (exports) { // text, but instead drawing text in the correct location, we'll draw it off screen (-paddingY), and then adjust the // drop shadow so only that appears on screen (+paddingY). Now we'll have the correct draw order of the shadow // beneath the text, whilst also having the proper text shadow styling. - for (var i = 0; i < passesCount; ++i) - { + for (var i = 0; i < passesCount; ++i) { var isShadowPass = style.dropShadow && i === 0; var dsOffsetText = isShadowPass ? height * 2 : 0; // we only want the drop shadow, so put text way off-screen var dsOffsetShadow = dsOffsetText * this.resolution; - - if (isShadowPass) - { + if (isShadowPass) { // On Safari, text with gradient and drop shadows together do not position correctly // if the scale of the canvas is not 1: https://bugs.webkit.org/show_bug.cgi?id=197689 // Therefore we'll set the styles to be a plain black whilst generating this drop shadow context.fillStyle = 'black'; context.strokeStyle = 'black'; - var dropShadowColor = style.dropShadowColor; var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); - - context.shadowColor = "rgba(" + (rgb[0] * 255) + "," + (rgb[1] * 255) + "," + (rgb[2] * 255) + "," + (style.dropShadowAlpha) + ")"; + context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; context.shadowBlur = style.dropShadowBlur; context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; context.shadowOffsetY = (Math.sin(style.dropShadowAngle) * style.dropShadowDistance) + dsOffsetShadow; } - else - { + else { // set canvas text styles - context.fillStyle = this._generateFillStyle(style, lines); + context.fillStyle = this._generateFillStyle(style, lines, measured); + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 context.strokeStyle = style.stroke; - - context.shadowColor = 0; + context.shadowColor = '0'; context.shadowBlur = 0; context.shadowOffsetX = 0; context.shadowOffsetY = 0; } - // draw lines line by line - for (var i$1 = 0; i$1 < lines.length; i$1++) - { + for (var i_1 = 0; i_1 < lines.length; i_1++) { linePositionX = style.strokeThickness / 2; - linePositionY = ((style.strokeThickness / 2) + (i$1 * lineHeight)) + fontProperties.ascent; - - if (style.align === 'right') - { - linePositionX += maxLineWidth - lineWidths[i$1]; + linePositionY = ((style.strokeThickness / 2) + (i_1 * lineHeight)) + fontProperties.ascent; + if (style.align === 'right') { + linePositionX += maxLineWidth - lineWidths[i_1]; } - else if (style.align === 'center') - { - linePositionX += (maxLineWidth - lineWidths[i$1]) / 2; + else if (style.align === 'center') { + linePositionX += (maxLineWidth - lineWidths[i_1]) / 2; } - - if (style.stroke && style.strokeThickness) - { - this.drawLetterSpacing( - lines[i$1], - linePositionX + style.padding, - linePositionY + style.padding - dsOffsetText, - true - ); + if (style.stroke && style.strokeThickness) { + this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText, true); } - - if (style.fill) - { - this.drawLetterSpacing( - lines[i$1], - linePositionX + style.padding, - linePositionY + style.padding - dsOffsetText - ); + if (style.fill) { + this.drawLetterSpacing(lines[i_1], linePositionX + style.padding, linePositionY + style.padding - dsOffsetText); } } } - this.updateTexture(); }; - /** * Render the text with letter-spacing. * @param {string} text - The text to draw @@ -41031,31 +37156,21 @@ var PIXI = (function (exports) { * text? If not, it's for the inside fill * @private */ - Text.prototype.drawLetterSpacing = function drawLetterSpacing (text, x, y, isStroke) - { - if ( isStroke === void 0 ) { isStroke = false; } - + Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) { + if (isStroke === void 0) { isStroke = false; } var style = this._style; - // letterSpacing of 0 means normal var letterSpacing = style.letterSpacing; - - if (letterSpacing === 0) - { - if (isStroke) - { + if (letterSpacing === 0) { + if (isStroke) { this.context.strokeText(text, x, y); } - else - { + else { this.context.fillText(text, x, y); } - return; } - var currentPosition = x; - // Using Array.from correctly splits characters whilst keeping emoji together. // This is not supported on IE as it requires ES6, so regular text splitting occurs. // This also doesn't account for emoji that are multiple emoji put together to make something else. @@ -41065,17 +37180,12 @@ var PIXI = (function (exports) { var stringArray = Array.from ? Array.from(text) : text.split(''); var previousWidth = this.context.measureText(text).width; var currentWidth = 0; - - for (var i = 0; i < stringArray.length; ++i) - { + for (var i = 0; i < stringArray.length; ++i) { var currentChar = stringArray[i]; - - if (isStroke) - { + if (isStroke) { this.context.strokeText(currentChar, currentPosition, y); } - else - { + else { this.context.fillText(currentChar, currentPosition, y); } currentWidth = this.context.measureText(text.substring(i + 1)).width; @@ -41083,102 +37193,72 @@ var PIXI = (function (exports) { previousWidth = currentWidth; } }; - /** * Updates texture size based on canvas size * * @private */ - Text.prototype.updateTexture = function updateTexture () - { + Text.prototype.updateTexture = function () { var canvas = this.canvas; - - if (this._style.trim) - { + if (this._style.trim) { var trimmed = trimCanvas(canvas); - - if (trimmed.data) - { + if (trimmed.data) { canvas.width = trimmed.width; canvas.height = trimmed.height; this.context.putImageData(trimmed.data, 0, 0); } } - var texture = this._texture; var style = this._style; var padding = style.trim ? 0 : style.padding; var baseTexture = texture.baseTexture; - texture.trim.width = texture._frame.width = Math.ceil(canvas.width / this._resolution); texture.trim.height = texture._frame.height = Math.ceil(canvas.height / this._resolution); texture.trim.x = -padding; texture.trim.y = -padding; - texture.orig.width = texture._frame.width - (padding * 2); texture.orig.height = texture._frame.height - (padding * 2); - // call sprite onTextureUpdate to update scale if _width or _height were set this._onTextureUpdate(); - baseTexture.setRealSize(canvas.width, canvas.height, this._resolution); - + // Recursively updates transform of all objects from the root to this one + this._recursivePostUpdateTransform(); this.dirty = false; }; - /** * Renders the object using the WebGL renderer * - * @private + * @protected * @param {PIXI.Renderer} renderer - The renderer */ - Text.prototype._render = function _render (renderer) - { - if (this._autoResolution && this._resolution !== renderer.resolution) - { + Text.prototype._render = function (renderer) { + if (this._autoResolution && this._resolution !== renderer.resolution) { this._resolution = renderer.resolution; this.dirty = true; } - this.updateText(true); - - Sprite.prototype._render.call(this, renderer); + _super.prototype._render.call(this, renderer); }; - /** * Gets the local bounds of the text object. * * @param {PIXI.Rectangle} rect - The output rectangle. * @return {PIXI.Rectangle} The bounds. */ - Text.prototype.getLocalBounds = function getLocalBounds (rect) - { + Text.prototype.getLocalBounds = function (rect) { this.updateText(true); - - return Sprite.prototype.getLocalBounds.call(this, rect); + return _super.prototype.getLocalBounds.call(this, rect); }; - /** * calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. * @protected */ - Text.prototype._calculateBounds = function _calculateBounds () - { + Text.prototype._calculateBounds = function () { this.updateText(true); this.calculateVertices(); // if we have already done this on THIS frame. this._bounds.addQuad(this.vertexData); }; - - /** - * Method to be called upon a TextStyle change. - * @private - */ - Text.prototype._onStyleChange = function _onStyleChange () - { - this.dirty = true; - }; - /** * Generates the fill style. Can automatically generate a gradient based on the fill style being an array * @@ -41187,109 +37267,98 @@ var PIXI = (function (exports) { * @param {string[]} lines - The lines of text. * @return {string|number|CanvasGradient} The fill style */ - Text.prototype._generateFillStyle = function _generateFillStyle (style, lines) - { - if (!Array.isArray(style.fill)) - { - return style.fill; + Text.prototype._generateFillStyle = function (style, lines, metrics) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var fillStyle = style.fill; + if (!Array.isArray(fillStyle)) { + return fillStyle; } - else if (style.fill.length === 1) - { - return style.fill[0]; + else if (fillStyle.length === 1) { + return fillStyle[0]; } - // the gradient will be evenly spaced out according to how large the array is. // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 var gradient; - var totalIterations; - var currentIteration; - var stop; - // a dropshadow will enlarge the canvas and result in the gradient being // generated with the incorrect dimensions var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; - - var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection; - var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection; - + // should also take padding into account, padding can offset the gradient + var padding = style.padding || 0; + var width = Math.ceil(this.canvas.width / this._resolution) - dropShadowCorrection - (padding * 2); + var height = Math.ceil(this.canvas.height / this._resolution) - dropShadowCorrection - (padding * 2); // make a copy of the style settings, so we can manipulate them later - var fill = style.fill.slice(); + var fill = fillStyle.slice(); var fillGradientStops = style.fillGradientStops.slice(); - // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 - if (!fillGradientStops.length) - { + if (!fillGradientStops.length) { var lengthPlus1 = fill.length + 1; - - for (var i = 1; i < lengthPlus1; ++i) - { + for (var i = 1; i < lengthPlus1; ++i) { fillGradientStops.push(i / lengthPlus1); } } - // stop the bleeding of the last gradient on the line above to the top gradient of the this line // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 - fill.unshift(style.fill[0]); + fill.unshift(fillStyle[0]); fillGradientStops.unshift(0); - - fill.push(style.fill[style.fill.length - 1]); + fill.push(fillStyle[fillStyle.length - 1]); fillGradientStops.push(1); - - if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL) - { + if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas - gradient = this.context.createLinearGradient(width / 2, 0, width / 2, height); - + gradient = this.context.createLinearGradient(width / 2, padding, width / 2, height + padding); // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 - totalIterations = (fill.length + 1) * lines.length; - currentIteration = 0; - for (var i$1 = 0; i$1 < lines.length; i$1++) - { - currentIteration += 1; - for (var j = 0; j < fill.length; j++) - { - if (typeof fillGradientStops[j] === 'number') - { - stop = (fillGradientStops[j] / lines.length) + (i$1 / lines.length); + // There's potential for floating point precision issues at the seams between gradient repeats. + // The loop below generates the stops in order, so track the last generated one to prevent + // floating point precision from making us go the teeniest bit backwards, resulting in + // the first and last colors getting swapped. + var lastIterationStop = 0; + // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc + var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; + // textHeight, but as a 0-1 size in global gradient stop space + var gradStopLineHeight = textHeight / height; + for (var i = 0; i < lines.length; i++) { + var thisLineTop = metrics.lineHeight * i; + for (var j = 0; j < fill.length; j++) { + // 0-1 stop point for the current line, multiplied to global space afterwards + var lineStop = 0; + if (typeof fillGradientStops[j] === 'number') { + lineStop = fillGradientStops[j]; } - else - { - stop = currentIteration / totalIterations; + else { + lineStop = j / fill.length; } - gradient.addColorStop(stop, fill[j]); - currentIteration++; + var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); + // Prevent color stop generation going backwards from floating point imprecision + var clampedStop = Math.max(lastIterationStop, globalStop); + clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. + gradient.addColorStop(clampedStop, fill[j]); + lastIterationStop = clampedStop; } } } - else - { + else { // start the gradient at the center left of the canvas, and end at the center right of the canvas - gradient = this.context.createLinearGradient(0, height / 2, width, height / 2); - + gradient = this.context.createLinearGradient(padding, height / 2, width + padding, height / 2); // can just evenly space out the gradients in this case, as multiple lines makes no difference // to an even left to right gradient - totalIterations = fill.length + 1; - currentIteration = 1; - - for (var i$2 = 0; i$2 < fill.length; i$2++) - { - if (typeof fillGradientStops[i$2] === 'number') - { - stop = fillGradientStops[i$2]; + var totalIterations = fill.length + 1; + var currentIteration = 1; + for (var i = 0; i < fill.length; i++) { + var stop = void 0; + if (typeof fillGradientStops[i] === 'number') { + stop = fillGradientStops[i]; } - else - { + else { stop = currentIteration / totalIterations; } - gradient.addColorStop(stop, fill[i$2]); + gradient.addColorStop(stop, fill[i]); currentIteration++; } } - return gradient; }; - /** * Destroys this text object. * Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as @@ -41302,150 +37371,134 @@ var PIXI = (function (exports) { * @param {boolean} [options.texture=true] - Should it destroy the current texture of the sprite as well * @param {boolean} [options.baseTexture=true] - Should it destroy the base texture of the sprite as well */ - Text.prototype.destroy = function destroy (options) - { - if (typeof options === 'boolean') - { + Text.prototype.destroy = function (options) { + if (typeof options === 'boolean') { options = { children: options }; } - options = Object.assign({}, defaultDestroyOptions, options); - - Sprite.prototype.destroy.call(this, options); - + _super.prototype.destroy.call(this, options); + // set canvas width and height to 0 to workaround memory leak in Safari < 13 + // https://stackoverflow.com/questions/52532614/total-canvas-memory-use-exceeds-the-maximum-limit-safari-12 + if (this._ownCanvas) { + this.canvas.height = this.canvas.width = 0; + } // make sure to reset the the context and canvas.. dont want this hanging around in memory! this.context = null; this.canvas = null; - this._style = null; }; - - /** - * The width of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - this.updateText(true); - - return Math.abs(this.scale.x) * this._texture.orig.width; - }; - - prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc - { - this.updateText(true); - - var s = sign$1(this.scale.x) || 1; - - this.scale.x = s * value / this._texture.orig.width; - this._width = value; - }; - - /** - * The height of the Text, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - this.updateText(true); - - return Math.abs(this.scale.y) * this._texture.orig.height; - }; - - prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc - { - this.updateText(true); - - var s = sign$1(this.scale.y) || 1; - - this.scale.y = s * value / this._texture.orig.height; - this._height = value; - }; - - /** - * Set the style of the text. Set up an event listener to listen for changes on the style - * object and mark the text as dirty. - * - * @member {object|PIXI.TextStyle} - */ - prototypeAccessors.style.get = function () - { - return this._style; - }; - - prototypeAccessors.style.set = function (style) // eslint-disable-line require-jsdoc - { - style = style || {}; - - if (style instanceof TextStyle) - { - this._style = style; - } - else - { - this._style = new TextStyle(style); - } - - this.localStyleID = -1; - this.dirty = true; - }; - - /** - * Set the copy for the text object. To split a line you can use '\n'. - * - * @member {string} - */ - prototypeAccessors.text.get = function () - { - return this._text; - }; - - prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc - { - text = String(text === null || text === undefined ? '' : text); - - if (this._text === text) - { - return; - } - this._text = text; - this.dirty = true; - }; - - /** - * The resolution / device pixel ratio of the canvas. - * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. - * @member {number} - * @default 1 - */ - prototypeAccessors.resolution.get = function () - { - return this._resolution; - }; - - prototypeAccessors.resolution.set = function (value) // eslint-disable-line require-jsdoc - { - this._autoResolution = false; - - if (this._resolution === value) - { - return; - } - - this._resolution = value; - this.dirty = true; - }; - - Object.defineProperties( Text.prototype, prototypeAccessors ); - + Object.defineProperty(Text.prototype, "width", { + /** + * The width of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + this.updateText(true); + return Math.abs(this.scale.x) * this._texture.orig.width; + }, + set: function (value) { + this.updateText(true); + var s = sign$1(this.scale.x) || 1; + this.scale.x = s * value / this._texture.orig.width; + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "height", { + /** + * The height of the Text, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + this.updateText(true); + return Math.abs(this.scale.y) * this._texture.orig.height; + }, + set: function (value) { + this.updateText(true); + var s = sign$1(this.scale.y) || 1; + this.scale.y = s * value / this._texture.orig.height; + this._height = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "style", { + /** + * Set the style of the text. Set up an event listener to listen for changes on the style + * object and mark the text as dirty. + * + * @member {object|PIXI.TextStyle} + */ + get: function () { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the ITextStyle + // since the setter creates the TextStyle. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + return this._style; + }, + set: function (style) { + style = style || {}; + if (style instanceof TextStyle) { + this._style = style; + } + else { + this._style = new TextStyle(style); + } + this.localStyleID = -1; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "text", { + /** + * Set the copy for the text object. To split a line you can use '\n'. + * + * @member {string} + */ + get: function () { + return this._text; + }, + set: function (text) { + text = String(text === null || text === undefined ? '' : text); + if (this._text === text) { + return; + } + this._text = text; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Text.prototype, "resolution", { + /** + * The resolution / device pixel ratio of the canvas. + * This is set to automatically match the renderer resolution by default, but can be overridden by setting manually. + * @member {number} + * @default 1 + */ + get: function () { + return this._resolution; + }, + set: function (value) { + this._autoResolution = false; + if (this._resolution === value) { + return; + } + this._resolution = value; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); return Text; }(Sprite)); /*! - * @pixi/prepare - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/prepare - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/prepare is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -41462,6 +37515,35 @@ var PIXI = (function (exports) { */ settings.UPLOADS_PER_FRAME = 4; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$8 = function(d, b) { + extendStatics$8 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$8(d, b); + }; + + function __extends$8(d, b) { + extendStatics$8(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + /** * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified * number of items per frame. @@ -41469,39 +37551,176 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var CountLimiter = function CountLimiter(maxItemsPerFrame) - { + var CountLimiter = /** @class */ (function () { /** - * The maximum number of items that can be prepared each frame. - * @type {number} - * @private + * @param {number} maxItemsPerFrame - The maximum number of items that can be prepared each frame. */ - this.maxItemsPerFrame = maxItemsPerFrame; + function CountLimiter(maxItemsPerFrame) { + /** + * The maximum number of items that can be prepared each frame. + * @type {number} + * @private + */ + this.maxItemsPerFrame = maxItemsPerFrame; + /** + * The number of items that can be prepared in the current frame. + * @type {number} + * @private + */ + this.itemsLeft = 0; + } /** - * The number of items that can be prepared in the current frame. - * @type {number} - * @private + * Resets any counting properties to start fresh on a new frame. */ - this.itemsLeft = 0; - }; + CountLimiter.prototype.beginFrame = function () { + this.itemsLeft = this.maxItemsPerFrame; + }; + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + CountLimiter.prototype.allowedToUpload = function () { + return this.itemsLeft-- > 0; + }; + return CountLimiter; + }()); /** - * Resets any counting properties to start fresh on a new frame. + * Built-in hook to find multiple textures from objects like AnimatedSprites. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. */ - CountLimiter.prototype.beginFrame = function beginFrame () - { - this.itemsLeft = this.maxItemsPerFrame; - }; - + function findMultipleBaseTextures(item, queue) { + var result = false; + // Objects with multiple textures + if (item && item._textures && item._textures.length) { + for (var i = 0; i < item._textures.length; i++) { + if (item._textures[i] instanceof Texture) { + var baseTexture = item._textures[i].baseTexture; + if (queue.indexOf(baseTexture) === -1) { + queue.push(baseTexture); + result = true; + } + } + } + } + return result; + } /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. + * Built-in hook to find BaseTextures from Texture. + * + * @private + * @param {PIXI.Texture} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. */ - CountLimiter.prototype.allowedToUpload = function allowedToUpload () - { - return this.itemsLeft-- > 0; - }; - + function findBaseTexture(item, queue) { + if (item.baseTexture instanceof BaseTexture) { + var texture = item.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to find textures from objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Texture object was found. + */ + function findTexture(item, queue) { + if (item._texture && item._texture instanceof Texture) { + var texture = item._texture.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to draw PIXI.Text to its texture. + * + * @private + * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function drawText(_helper, item) { + if (item instanceof Text) { + // updating text will return early if it is not dirty + item.updateText(true); + return true; + } + return false; + } + /** + * Built-in hook to calculate a text style for a PIXI.Text object. + * + * @private + * @param {PIXI.AbstractRenderer|PIXI.BasePrepare} helper - Not used by this upload handler + * @param {PIXI.DisplayObject} item - Item to check + * @return {boolean} If item was uploaded. + */ + function calculateTextStyle(_helper, item) { + if (item instanceof TextStyle) { + var font = item.toFontString(); + TextMetrics.measureFont(font); + return true; + } + return false; + } + /** + * Built-in hook to find Text objects. + * + * @private + * @param {PIXI.DisplayObject} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.Text object was found. + */ + function findText(item, queue) { + if (item instanceof Text) { + // push the text style to prepare it - this can be really expensive + if (queue.indexOf(item.style) === -1) { + queue.push(item.style); + } + // also push the text object so that we can render it (to canvas/texture) if needed + if (queue.indexOf(item) === -1) { + queue.push(item); + } + // also push the Text's texture for upload to GPU + var texture = item._texture.baseTexture; + if (queue.indexOf(texture) === -1) { + queue.push(texture); + } + return true; + } + return false; + } + /** + * Built-in hook to find TextStyle objects. + * + * @private + * @param {PIXI.TextStyle} item - Display object to check + * @param {Array<*>} queue - Collection of items to upload + * @return {boolean} if a PIXI.TextStyle object was found. + */ + function findTextStyle(item, queue) { + if (item instanceof TextStyle) { + if (queue.indexOf(item) === -1) { + queue.push(item); + } + return true; + } + return false; + } /** * The prepare manager provides functionality to upload content to the GPU. * @@ -41525,470 +37744,295 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var BasePrepare = function BasePrepare(renderer) - { - var this$1 = this; - + var BasePrepare = /** @class */ (function () { /** - * The limiter to be used to control how quickly items are prepared. - * @type {PIXI.CountLimiter|PIXI.TimeLimiter} + * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer */ - this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); - + function BasePrepare(renderer) { + var _this = this; + /** + * The limiter to be used to control how quickly items are prepared. + * @type {PIXI.CountLimiter|PIXI.TimeLimiter} + */ + this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME); + /** + * Reference to the renderer. + * @type {PIXI.AbstractRenderer} + * @protected + */ + this.renderer = renderer; + /** + * The only real difference between CanvasPrepare and Prepare is what they pass + * to upload hooks. That different parameter is stored here. + * @type {object} + * @protected + */ + this.uploadHookHelper = null; + /** + * Collection of items to uploads at once. + * @type {Array<*>} + * @private + */ + this.queue = []; + /** + * Collection of additional hooks for finding assets. + * @type {Array} + * @private + */ + this.addHooks = []; + /** + * Collection of additional hooks for processing assets. + * @type {Array} + * @private + */ + this.uploadHooks = []; + /** + * Callback to call after completed. + * @type {Array} + * @private + */ + this.completes = []; + /** + * If prepare is ticking (running). + * @type {boolean} + * @private + */ + this.ticking = false; + /** + * 'bound' call for prepareItems(). + * @type {Function} + * @private + */ + this.delayedTick = function () { + // unlikely, but in case we were destroyed between tick() and delayedTick() + if (!_this.queue) { + return; + } + _this.prepareItems(); + }; + // hooks to find the correct texture + this.registerFindHook(findText); + this.registerFindHook(findTextStyle); + this.registerFindHook(findMultipleBaseTextures); + this.registerFindHook(findBaseTexture); + this.registerFindHook(findTexture); + // upload hooks + this.registerUploadHook(drawText); + this.registerUploadHook(calculateTextStyle); + } /** - * Reference to the renderer. - * @type {PIXI.AbstractRenderer} - * @protected + * Upload all the textures and graphics to the GPU. + * + * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - + * Either the container or display object to search for items to upload, the items to upload themselves, + * or the callback function, if items have been added using `prepare.add`. + * @param {Function} [done] - Optional callback when all queued uploads have completed */ - this.renderer = renderer; - - /** - * The only real difference between CanvasPrepare and Prepare is what they pass - * to upload hooks. That different parameter is stored here. - * @type {object} - * @protected - */ - this.uploadHookHelper = null; - - /** - * Collection of items to uploads at once. - * @type {Array<*>} - * @private - */ - this.queue = []; - - /** - * Collection of additional hooks for finding assets. - * @type {Array} - * @private - */ - this.addHooks = []; - - /** - * Collection of additional hooks for processing assets. - * @type {Array} - * @private - */ - this.uploadHooks = []; - - /** - * Callback to call after completed. - * @type {Array} - * @private - */ - this.completes = []; - - /** - * If prepare is ticking (running). - * @type {boolean} - * @private - */ - this.ticking = false; - - /** - * 'bound' call for prepareItems(). - * @type {Function} - * @private - */ - this.delayedTick = function () { - // unlikely, but in case we were destroyed between tick() and delayedTick() - if (!this$1.queue) - { - return; + BasePrepare.prototype.upload = function (item, done) { + if (typeof item === 'function') { + done = item; + item = null; + } + // If a display object, search for items + // that we could upload + if (item) { + this.add(item); + } + // Get the items for upload from the display + if (this.queue.length) { + if (done) { + this.completes.push(done); + } + if (!this.ticking) { + this.ticking = true; + Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); + } + } + else if (done) { + done(); } - this$1.prepareItems(); }; - - // hooks to find the correct texture - this.registerFindHook(findText); - this.registerFindHook(findTextStyle); - this.registerFindHook(findMultipleBaseTextures); - this.registerFindHook(findBaseTexture); - this.registerFindHook(findTexture); - - // upload hooks - this.registerUploadHook(drawText); - this.registerUploadHook(calculateTextStyle); - }; - - /** - * Upload all the textures and graphics to the GPU. - * - * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item - - * Either the container or display object to search for items to upload, the items to upload themselves, - * or the callback function, if items have been added using `prepare.add`. - * @param {Function} [done] - Optional callback when all queued uploads have completed - */ - BasePrepare.prototype.upload = function upload (item, done) - { - if (typeof item === 'function') - { - done = item; - item = null; - } - - // If a display object, search for items - // that we could upload - if (item) - { - this.add(item); - } - - // Get the items for upload from the display - if (this.queue.length) - { - if (done) - { - this.completes.push(done); + /** + * Handle tick update + * + * @private + */ + BasePrepare.prototype.tick = function () { + setTimeout(this.delayedTick, 0); + }; + /** + * Actually prepare items. This is handled outside of the tick because it will take a while + * and we do NOT want to block the current animation frame from rendering. + * + * @private + */ + BasePrepare.prototype.prepareItems = function () { + this.limiter.beginFrame(); + // Upload the graphics + while (this.queue.length && this.limiter.allowedToUpload()) { + var item = this.queue[0]; + var uploaded = false; + if (item && !item._destroyed) { + for (var i = 0, len = this.uploadHooks.length; i < len; i++) { + if (this.uploadHooks[i](this.uploadHookHelper, item)) { + this.queue.shift(); + uploaded = true; + break; + } + } + } + if (!uploaded) { + this.queue.shift(); + } } - - if (!this.ticking) - { - this.ticking = true; + // We're finished + if (!this.queue.length) { + this.ticking = false; + var completes = this.completes.slice(0); + this.completes.length = 0; + for (var i = 0, len = completes.length; i < len; i++) { + completes[i](); + } + } + else { + // if we are not finished, on the next rAF do this again Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); } - } - else if (done) - { - done(); - } - }; - - /** - * Handle tick update - * - * @private - */ - BasePrepare.prototype.tick = function tick () - { - setTimeout(this.delayedTick, 0); - }; - - /** - * Actually prepare items. This is handled outside of the tick because it will take a while - * and we do NOT want to block the current animation frame from rendering. - * - * @private - */ - BasePrepare.prototype.prepareItems = function prepareItems () - { - this.limiter.beginFrame(); - // Upload the graphics - while (this.queue.length && this.limiter.allowedToUpload()) - { - var item = this.queue[0]; - var uploaded = false; - - if (item && !item._destroyed) - { - for (var i = 0, len = this.uploadHooks.length; i < len; i++) - { - if (this.uploadHooks[i](this.uploadHookHelper, item)) - { - this.queue.shift(); - uploaded = true; - break; - } + }; + /** + * Adds hooks for finding items. + * + * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` + * function must return `true` if it was able to add item to the queue. + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.registerFindHook = function (addHook) { + if (addHook) { + this.addHooks.push(addHook); + } + return this; + }; + /** + * Adds hooks for uploading items. + * + * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and + * function must return `true` if it was able to handle upload of item. + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.registerUploadHook = function (uploadHook) { + if (uploadHook) { + this.uploadHooks.push(uploadHook); + } + return this; + }; + /** + * Manually add an item to the uploading queue. + * + * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to + * add to the queue + * @return {this} Instance of plugin for chaining. + */ + BasePrepare.prototype.add = function (item) { + // Add additional hooks for finding elements on special + // types of objects that + for (var i = 0, len = this.addHooks.length; i < len; i++) { + if (this.addHooks[i](item, this.queue)) { + break; } } - - if (!uploaded) - { - this.queue.shift(); + // Get children recursively + if (item instanceof Container) { + for (var i = item.children.length - 1; i >= 0; i--) { + this.add(item.children[i]); + } + } + return this; + }; + /** + * Destroys the plugin, don't use after this. + * + */ + BasePrepare.prototype.destroy = function () { + if (this.ticking) { + Ticker.system.remove(this.tick, this); } - } - - // We're finished - if (!this.queue.length) - { this.ticking = false; - - var completes = this.completes.slice(0); - - this.completes.length = 0; - - for (var i$1 = 0, len$1 = completes.length; i$1 < len$1; i$1++) - { - completes[i$1](); - } - } - else - { - // if we are not finished, on the next rAF do this again - Ticker.system.addOnce(this.tick, this, exports.UPDATE_PRIORITY.UTILITY); - } - }; + this.addHooks = null; + this.uploadHooks = null; + this.renderer = null; + this.completes = null; + this.queue = null; + this.limiter = null; + this.uploadHookHelper = null; + }; + return BasePrepare; + }()); /** - * Adds hooks for finding items. - * - * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array` - * function must return `true` if it was able to add item to the queue. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerFindHook = function registerFindHook (addHook) - { - if (addHook) - { - this.addHooks.push(addHook); - } - - return this; - }; - - /** - * Adds hooks for uploading items. - * - * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and - * function must return `true` if it was able to handle upload of item. - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.registerUploadHook = function registerUploadHook (uploadHook) - { - if (uploadHook) - { - this.uploadHooks.push(uploadHook); - } - - return this; - }; - - /** - * Manually add an item to the uploading queue. - * - * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to - * add to the queue - * @return {this} Instance of plugin for chaining. - */ - BasePrepare.prototype.add = function add (item) - { - // Add additional hooks for finding elements on special - // types of objects that - for (var i = 0, len = this.addHooks.length; i < len; i++) - { - if (this.addHooks[i](item, this.queue)) - { - break; - } - } - - // Get children recursively - if (item instanceof Container) - { - for (var i$1 = item.children.length - 1; i$1 >= 0; i$1--) - { - this.add(item.children[i$1]); - } - } - - return this; - }; - - /** - * Destroys the plugin, don't use after this. - * - */ - BasePrepare.prototype.destroy = function destroy () - { - if (this.ticking) - { - Ticker.system.remove(this.tick, this); - } - this.ticking = false; - this.addHooks = null; - this.uploadHooks = null; - this.renderer = null; - this.completes = null; - this.queue = null; - this.limiter = null; - this.uploadHookHelper = null; - }; - - /** - * Built-in hook to find multiple textures from objects like AnimatedSprites. + * Built-in hook to upload PIXI.Texture objects to the GPU. * * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. + * @param {PIXI.Renderer} renderer - instance of the webgl renderer + * @param {PIXI.BaseTexture} item - Item to check + * @return {boolean} If item was uploaded. */ - function findMultipleBaseTextures(item, queue) - { - var result = false; - - // Objects with multiple textures - if (item && item._textures && item._textures.length) - { - for (var i = 0; i < item._textures.length; i++) - { - if (item._textures[i] instanceof Texture) - { - var baseTexture = item._textures[i].baseTexture; - - if (queue.indexOf(baseTexture) === -1) - { - queue.push(baseTexture); - result = true; - } - } + function uploadBaseTextures(renderer, item) { + if (item instanceof BaseTexture) { + // if the texture already has a GL texture, then the texture has been prepared or rendered + // before now. If the texture changed, then the changer should be calling texture.update() which + // reuploads the texture without need for preparing it again + if (!item._glTextures[renderer.CONTEXT_UID]) { + renderer.texture.bind(item); } - } - - return result; - } - - /** - * Built-in hook to find BaseTextures from Texture. - * - * @private - * @param {PIXI.Texture} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findBaseTexture(item, queue) - { - if (item.baseTexture instanceof BaseTexture) - { - var texture = item.baseTexture; - - if (queue.indexOf(texture) === -1) - { - queue.push(texture); - } - return true; } - return false; } - /** - * Built-in hook to find textures from objects. + * Built-in hook to upload PIXI.Graphics to the GPU. * * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Texture object was found. - */ - function findTexture(item, queue) - { - if (item._texture && item._texture instanceof Texture) - { - var texture = item._texture.baseTexture; - - if (queue.indexOf(texture) === -1) - { - queue.push(texture); - } - - return true; - } - - return false; - } - - /** - * Built-in hook to draw PIXI.Text to its texture. - * - * @private - * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler + * @param {PIXI.Renderer} renderer - instance of the webgl renderer * @param {PIXI.DisplayObject} item - Item to check * @return {boolean} If item was uploaded. */ - function drawText(helper, item) - { - if (item instanceof Text) - { - // updating text will return early if it is not dirty - item.updateText(true); - - return true; + function uploadGraphics(renderer, item) { + if (!(item instanceof Graphics)) { + return false; } - - return false; - } - - /** - * Built-in hook to calculate a text style for a PIXI.Text object. - * - * @private - * @param {PIXI.Renderer|PIXI.CanvasPrepare} helper - Not used by this upload handler - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function calculateTextStyle(helper, item) - { - if (item instanceof TextStyle) - { - var font = item.toFontString(); - - TextMetrics.measureFont(font); - - return true; + var geometry = item.geometry; + // update dirty graphics to get batches + item.finishPoly(); + geometry.updateBatches(); + var batches = geometry.batches; + // upload all textures found in styles + for (var i = 0; i < batches.length; i++) { + var texture = batches[i].style.texture; + if (texture) { + uploadBaseTextures(renderer, texture.baseTexture); + } } - - return false; + // if its not batchable - update vao for particular shader + if (!geometry.batchable) { + renderer.geometry.bind(geometry, item._resolveDirectShader(renderer)); + } + return true; } - /** - * Built-in hook to find Text objects. + * Built-in hook to find graphics. * * @private * @param {PIXI.DisplayObject} item - Display object to check * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Text object was found. + * @return {boolean} if a PIXI.Graphics object was found. */ - function findText(item, queue) - { - if (item instanceof Text) - { - // push the text style to prepare it - this can be really expensive - if (queue.indexOf(item.style) === -1) - { - queue.push(item.style); - } - // also push the text object so that we can render it (to canvas/texture) if needed - if (queue.indexOf(item) === -1) - { - queue.push(item); - } - // also push the Text's texture for upload to GPU - var texture = item._texture.baseTexture; - - if (queue.indexOf(texture) === -1) - { - queue.push(texture); - } - + function findGraphics(item, queue) { + if (item instanceof Graphics) { + queue.push(item); return true; } - return false; } - - /** - * Built-in hook to find TextStyle objects. - * - * @private - * @param {PIXI.TextStyle} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.TextStyle object was found. - */ - function findTextStyle(item, queue) - { - if (item instanceof TextStyle) - { - if (queue.indexOf(item) === -1) - { - queue.push(item); - } - - return true; - } - - return false; - } - /** * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed. @@ -42020,114 +38064,22 @@ var PIXI = (function (exports) { * @extends PIXI.BasePrepare * @memberof PIXI */ - var Prepare = /*@__PURE__*/(function (BasePrepare) { - function Prepare(renderer) - { - BasePrepare.call(this, renderer); - - this.uploadHookHelper = this.renderer; - + var Prepare = /** @class */ (function (_super) { + __extends$8(Prepare, _super); + /** + * @param {PIXI.Renderer} renderer - A reference to the current renderer + */ + function Prepare(renderer) { + var _this = _super.call(this, renderer) || this; + _this.uploadHookHelper = _this.renderer; // Add textures and graphics to upload - this.registerFindHook(findGraphics); - this.registerUploadHook(uploadBaseTextures); - this.registerUploadHook(uploadGraphics); + _this.registerFindHook(findGraphics); + _this.registerUploadHook(uploadBaseTextures); + _this.registerUploadHook(uploadGraphics); + return _this; } - - if ( BasePrepare ) { Prepare.__proto__ = BasePrepare; } - Prepare.prototype = Object.create( BasePrepare && BasePrepare.prototype ); - Prepare.prototype.constructor = Prepare; - return Prepare; }(BasePrepare)); - /** - * Built-in hook to upload PIXI.Texture objects to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.BaseTexture} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadBaseTextures(renderer, item) - { - if (item instanceof BaseTexture) - { - // if the texture already has a GL texture, then the texture has been prepared or rendered - // before now. If the texture changed, then the changer should be calling texture.update() which - // reuploads the texture without need for preparing it again - if (!item._glTextures[renderer.CONTEXT_UID]) - { - renderer.texture.bind(item); - } - - return true; - } - - return false; - } - - /** - * Built-in hook to upload PIXI.Graphics to the GPU. - * - * @private - * @param {PIXI.Renderer} renderer - instance of the webgl renderer - * @param {PIXI.DisplayObject} item - Item to check - * @return {boolean} If item was uploaded. - */ - function uploadGraphics(renderer, item) - { - if (!(item instanceof Graphics)) - { - return false; - } - - var geometry = item.geometry; - - // update dirty graphics to get batches - item.finishPoly(); - geometry.updateBatches(); - - var batches = geometry.batches; - - // upload all textures found in styles - for (var i = 0; i < batches.length; i++) - { - var ref = batches[i].style; - var texture = ref.texture; - - if (texture) - { - uploadBaseTextures(renderer, texture.baseTexture); - } - } - - // if its not batchable - update vao for particular shader - if (!geometry.batchable) - { - renderer.geometry.bind(geometry, item._resolveDirectShader()); - } - - return true; - } - - /** - * Built-in hook to find graphics. - * - * @private - * @param {PIXI.DisplayObject} item - Display object to check - * @param {Array<*>} queue - Collection of items to upload - * @return {boolean} if a PIXI.Graphics object was found. - */ - function findGraphics(item, queue) - { - if (item instanceof Graphics) - { - queue.push(item); - - return true; - } - - return false; - } /** * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified @@ -42136,42 +38088,43 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var TimeLimiter = function TimeLimiter(maxMilliseconds) - { + var TimeLimiter = /** @class */ (function () { /** - * The maximum milliseconds that can be spent preparing items each frame. - * @type {number} - * @private + * @param {number} maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. */ - this.maxMilliseconds = maxMilliseconds; + function TimeLimiter(maxMilliseconds) { + /** + * The maximum milliseconds that can be spent preparing items each frame. + * @type {number} + * @private + */ + this.maxMilliseconds = maxMilliseconds; + /** + * The start time of the current frame. + * @type {number} + * @private + */ + this.frameStart = 0; + } /** - * The start time of the current frame. - * @type {number} - * @private + * Resets any counting properties to start fresh on a new frame. */ - this.frameStart = 0; - }; - - /** - * Resets any counting properties to start fresh on a new frame. - */ - TimeLimiter.prototype.beginFrame = function beginFrame () - { - this.frameStart = Date.now(); - }; - - /** - * Checks to see if another item can be uploaded. This should only be called once per item. - * @return {boolean} If the item is allowed to be uploaded. - */ - TimeLimiter.prototype.allowedToUpload = function allowedToUpload () - { - return Date.now() - this.frameStart < this.maxMilliseconds; - }; + TimeLimiter.prototype.beginFrame = function () { + this.frameStart = Date.now(); + }; + /** + * Checks to see if another item can be uploaded. This should only be called once per item. + * @return {boolean} If the item is allowed to be uploaded. + */ + TimeLimiter.prototype.allowedToUpload = function () { + return Date.now() - this.frameStart < this.maxMilliseconds; + }; + return TimeLimiter; + }()); /*! - * @pixi/spritesheet - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/spritesheet - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/spritesheet is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -42201,305 +38154,238 @@ var PIXI = (function (exports) { * @class * @memberof PIXI */ - var Spritesheet = function Spritesheet(baseTexture, data, resolutionFilename) - { - if ( resolutionFilename === void 0 ) { resolutionFilename = null; } - + var Spritesheet = /** @class */ (function () { /** - * Reference to ths source texture - * @type {PIXI.BaseTexture} + * @param {PIXI.BaseTexture|PIXI.Texture} baseTexture - Reference to the source BaseTexture object. + * @param {Object} data - Spritesheet image data. + * @param {string} [resolutionFilename] - The filename to consider when determining + * the resolution of the spritesheet. If not provided, the imageUrl will + * be used on the BaseTexture. */ - this.baseTexture = baseTexture; - + function Spritesheet(texture, data, resolutionFilename) { + if (resolutionFilename === void 0) { resolutionFilename = null; } + /** + * Reference to original source image from the Loader. This reference is retained so we + * can destroy the Texture later on. It is never used internally. + * @type {PIXI.Texture} + * @private + */ + this._texture = texture instanceof Texture ? texture : null; + /** + * Reference to ths source texture. + * @type {PIXI.BaseTexture} + */ + this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture; + /** + * A map containing all textures of the sprite sheet. + * Can be used to create a {@link PIXI.Sprite|Sprite}: + * ```js + * new PIXI.Sprite(sheet.textures["image.png"]); + * ``` + * @member {Object} + */ + this.textures = {}; + /** + * A map containing the textures for each animation. + * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: + * ```js + * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) + * ``` + * @member {Object} + */ + this.animations = {}; + /** + * Reference to the original JSON data. + * @type {Object} + */ + this.data = data; + var resource = this.baseTexture.resource; + /** + * The resolution of the spritesheet. + * @type {number} + */ + this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)); + /** + * Map of spritesheet frames. + * @type {Object} + * @private + */ + this._frames = this.data.frames; + /** + * Collection of frame names. + * @type {string[]} + * @private + */ + this._frameKeys = Object.keys(this._frames); + /** + * Current batch index being processed. + * @type {number} + * @private + */ + this._batchIndex = 0; + /** + * Callback when parse is completed. + * @type {Function} + * @private + */ + this._callback = null; + } /** - * A map containing all textures of the sprite sheet. - * Can be used to create a {@link PIXI.Sprite|Sprite}: - * ```js - * new PIXI.Sprite(sheet.textures["image.png"]); - * ``` - * @member {Object} + * Generate the resolution from the filename or fallback + * to the meta.scale field of the JSON data. + * + * @private + * @param {string} resolutionFilename - The filename to use for resolving + * the default resolution. + * @return {number} Resolution to use for spritesheet. */ - this.textures = {}; - + Spritesheet.prototype._updateResolution = function (resolutionFilename) { + if (resolutionFilename === void 0) { resolutionFilename = null; } + var scale = this.data.meta.scale; + // Use a defaultValue of `null` to check if a url-based resolution is set + var resolution = getResolutionOfUrl(resolutionFilename, null); + // No resolution found via URL + if (resolution === null) { + // Use the scale value or default to 1 + resolution = scale !== undefined ? parseFloat(scale) : 1; + } + // For non-1 resolutions, update baseTexture + if (resolution !== 1) { + this.baseTexture.setResolution(resolution); + } + return resolution; + }; /** - * A map containing the textures for each animation. - * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}: - * ```js - * new PIXI.AnimatedSprite(sheet.animations["anim_name"]) - * ``` - * @member {Object} + * Parser spritesheet from loaded data. This is done asynchronously + * to prevent creating too many Texture within a single process. + * + * @param {Function} callback - Callback when complete returns + * a map of the Textures for this spritesheet. */ - this.animations = {}; - + Spritesheet.prototype.parse = function (callback) { + this._batchIndex = 0; + this._callback = callback; + if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) { + this._processFrames(0); + this._processAnimations(); + this._parseComplete(); + } + else { + this._nextBatch(); + } + }; /** - * Reference to the original JSON data. - * @type {Object} + * Process a batch of frames + * + * @private + * @param {number} initialFrameIndex - The index of frame to start. */ - this.data = data; - + Spritesheet.prototype._processFrames = function (initialFrameIndex) { + var frameIndex = initialFrameIndex; + var maxFrames = Spritesheet.BATCH_SIZE; + while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) { + var i = this._frameKeys[frameIndex]; + var data = this._frames[i]; + var rect = data.frame; + if (rect) { + var frame = null; + var trim = null; + var sourceSize = data.trimmed !== false && data.sourceSize + ? data.sourceSize : data.frame; + var orig = new Rectangle(0, 0, Math.floor(sourceSize.w) / this.resolution, Math.floor(sourceSize.h) / this.resolution); + if (data.rotated) { + frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.h) / this.resolution, Math.floor(rect.w) / this.resolution); + } + else { + frame = new Rectangle(Math.floor(rect.x) / this.resolution, Math.floor(rect.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); + } + // Check to see if the sprite is trimmed + if (data.trimmed !== false && data.spriteSourceSize) { + trim = new Rectangle(Math.floor(data.spriteSourceSize.x) / this.resolution, Math.floor(data.spriteSourceSize.y) / this.resolution, Math.floor(rect.w) / this.resolution, Math.floor(rect.h) / this.resolution); + } + this.textures[i] = new Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor); + // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions + Texture.addToCache(this.textures[i], i); + } + frameIndex++; + } + }; /** - * The resolution of the spritesheet. + * Parse animations config + * + * @private + */ + Spritesheet.prototype._processAnimations = function () { + var animations = this.data.animations || {}; + for (var animName in animations) { + this.animations[animName] = []; + for (var i = 0; i < animations[animName].length; i++) { + var frameName = animations[animName][i]; + this.animations[animName].push(this.textures[frameName]); + } + } + }; + /** + * The parse has completed. + * + * @private + */ + Spritesheet.prototype._parseComplete = function () { + var callback = this._callback; + this._callback = null; + this._batchIndex = 0; + callback.call(this, this.textures); + }; + /** + * Begin the next batch of textures. + * + * @private + */ + Spritesheet.prototype._nextBatch = function () { + var _this = this; + this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); + this._batchIndex++; + setTimeout(function () { + if (_this._batchIndex * Spritesheet.BATCH_SIZE < _this._frameKeys.length) { + _this._nextBatch(); + } + else { + _this._processAnimations(); + _this._parseComplete(); + } + }, 0); + }; + /** + * Destroy Spritesheet and don't use after this. + * + * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well + */ + Spritesheet.prototype.destroy = function (destroyBase) { + var _a; + if (destroyBase === void 0) { destroyBase = false; } + for (var i in this.textures) { + this.textures[i].destroy(); + } + this._frames = null; + this._frameKeys = null; + this.data = null; + this.textures = null; + if (destroyBase) { + (_a = this._texture) === null || _a === void 0 ? void 0 : _a.destroy(); + this.baseTexture.destroy(); + } + this._texture = null; + this.baseTexture = null; + }; + /** + * The maximum number of Textures to build per process. + * * @type {number} + * @default 1000 */ - this.resolution = this._updateResolution( - resolutionFilename - || (this.baseTexture.resource ? this.baseTexture.resource.url : null) - ); - - /** - * Map of spritesheet frames. - * @type {Object} - * @private - */ - this._frames = this.data.frames; - - /** - * Collection of frame names. - * @type {string[]} - * @private - */ - this._frameKeys = Object.keys(this._frames); - - /** - * Current batch index being processed. - * @type {number} - * @private - */ - this._batchIndex = 0; - - /** - * Callback when parse is completed. - * @type {Function} - * @private - */ - this._callback = null; - }; - - var staticAccessors$2 = { BATCH_SIZE: { configurable: true } }; - - /** - * Generate the resolution from the filename or fallback - * to the meta.scale field of the JSON data. - * - * @private - * @param {string} resolutionFilename - The filename to use for resolving - * the default resolution. - * @return {number} Resolution to use for spritesheet. - */ - staticAccessors$2.BATCH_SIZE.get = function () - { - return 1000; - }; - - Spritesheet.prototype._updateResolution = function _updateResolution (resolutionFilename) - { - var scale = this.data.meta.scale; - - // Use a defaultValue of `null` to check if a url-based resolution is set - var resolution = getResolutionOfUrl(resolutionFilename, null); - - // No resolution found via URL - if (resolution === null) - { - // Use the scale value or default to 1 - resolution = scale !== undefined ? parseFloat(scale) : 1; - } - - // For non-1 resolutions, update baseTexture - if (resolution !== 1) - { - this.baseTexture.setResolution(resolution); - } - - return resolution; - }; - - /** - * Parser spritesheet from loaded data. This is done asynchronously - * to prevent creating too many Texture within a single process. - * - * @param {Function} callback - Callback when complete returns - * a map of the Textures for this spritesheet. - */ - Spritesheet.prototype.parse = function parse (callback) - { - this._batchIndex = 0; - this._callback = callback; - - if (this._frameKeys.length <= Spritesheet.BATCH_SIZE) - { - this._processFrames(0); - this._processAnimations(); - this._parseComplete(); - } - else - { - this._nextBatch(); - } - }; - - /** - * Process a batch of frames - * - * @private - * @param {number} initialFrameIndex - The index of frame to start. - */ - Spritesheet.prototype._processFrames = function _processFrames (initialFrameIndex) - { - var frameIndex = initialFrameIndex; - var maxFrames = Spritesheet.BATCH_SIZE; - - while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length) - { - var i = this._frameKeys[frameIndex]; - var data = this._frames[i]; - var rect = data.frame; - - if (rect) - { - var frame = null; - var trim = null; - var sourceSize = data.trimmed !== false && data.sourceSize - ? data.sourceSize : data.frame; - - var orig = new Rectangle( - 0, - 0, - Math.floor(sourceSize.w) / this.resolution, - Math.floor(sourceSize.h) / this.resolution - ); - - if (data.rotated) - { - frame = new Rectangle( - Math.floor(rect.x) / this.resolution, - Math.floor(rect.y) / this.resolution, - Math.floor(rect.h) / this.resolution, - Math.floor(rect.w) / this.resolution - ); - } - else - { - frame = new Rectangle( - Math.floor(rect.x) / this.resolution, - Math.floor(rect.y) / this.resolution, - Math.floor(rect.w) / this.resolution, - Math.floor(rect.h) / this.resolution - ); - } - - // Check to see if the sprite is trimmed - if (data.trimmed !== false && data.spriteSourceSize) - { - trim = new Rectangle( - Math.floor(data.spriteSourceSize.x) / this.resolution, - Math.floor(data.spriteSourceSize.y) / this.resolution, - Math.floor(rect.w) / this.resolution, - Math.floor(rect.h) / this.resolution - ); - } - - this.textures[i] = new Texture( - this.baseTexture, - frame, - orig, - trim, - data.rotated ? 2 : 0, - data.anchor - ); - - // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions - Texture.addToCache(this.textures[i], i); - } - - frameIndex++; - } - }; - - /** - * Parse animations config - * - * @private - */ - Spritesheet.prototype._processAnimations = function _processAnimations () - { - var animations = this.data.animations || {}; - - for (var animName in animations) - { - this.animations[animName] = []; - for (var i = 0; i < animations[animName].length; i++) - { - var frameName = animations[animName][i]; - - this.animations[animName].push(this.textures[frameName]); - } - } - }; - - /** - * The parse has completed. - * - * @private - */ - Spritesheet.prototype._parseComplete = function _parseComplete () - { - var callback = this._callback; - - this._callback = null; - this._batchIndex = 0; - callback.call(this, this.textures); - }; - - /** - * Begin the next batch of textures. - * - * @private - */ - Spritesheet.prototype._nextBatch = function _nextBatch () - { - var this$1 = this; - - this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE); - this._batchIndex++; - setTimeout(function () { - if (this$1._batchIndex * Spritesheet.BATCH_SIZE < this$1._frameKeys.length) - { - this$1._nextBatch(); - } - else - { - this$1._processAnimations(); - this$1._parseComplete(); - } - }, 0); - }; - - /** - * Destroy Spritesheet and don't use after this. - * - * @param {boolean} [destroyBase=false] Whether to destroy the base texture as well - */ - Spritesheet.prototype.destroy = function destroy (destroyBase) - { - if ( destroyBase === void 0 ) { destroyBase = false; } - - for (var i in this.textures) - { - this.textures[i].destroy(); - } - this._frames = null; - this._frameKeys = null; - this.data = null; - this.textures = null; - if (destroyBase) - { - this.baseTexture.destroy(); - } - this.baseTexture = null; - }; - - Object.defineProperties( Spritesheet, staticAccessors$2 ); + Spritesheet.BATCH_SIZE = 1000; + return Spritesheet; + }()); /** * {@link PIXI.Loader Loader} middleware for loading texture atlases that have been created with @@ -42511,82 +38397,100 @@ var PIXI = (function (exports) { * @memberof PIXI * @implements PIXI.ILoaderPlugin */ - var SpritesheetLoader = function SpritesheetLoader () {}; - - SpritesheetLoader.use = function use (resource, next) - { - var imageResourceName = (resource.name) + "_image"; - - // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists - if (!resource.data - || resource.type !== LoaderResource.TYPE.JSON - || !resource.data.frames - || this.resources[imageResourceName] - ) - { - next(); - - return; + var SpritesheetLoader = /** @class */ (function () { + function SpritesheetLoader() { } - - var loadOptions = { - crossOrigin: resource.crossOrigin, - metadata: resource.metadata.imageMetadata, - parentResource: resource, - }; - - var resourcePath = SpritesheetLoader.getResourcePath(resource, this.baseUrl); - - // load the image for this sheet - this.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) - { - if (res.error) - { - next(res.error); - + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + SpritesheetLoader.use = function (resource, next) { + // because this is middleware, it execute in loader context. `this` = loader + var loader = this; + var imageResourceName = resource.name + "_image"; + // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists + if (!resource.data + || resource.type !== LoaderResource.TYPE.JSON + || !resource.data.frames + || loader.resources[imageResourceName]) { + next(); return; } - - var spritesheet = new Spritesheet( - res.texture.baseTexture, - resource.data, - resource.url - ); - - spritesheet.parse(function () { - resource.spritesheet = spritesheet; - resource.textures = spritesheet.textures; - next(); + var loadOptions = { + crossOrigin: resource.crossOrigin, + metadata: resource.metadata.imageMetadata, + parentResource: resource, + }; + var resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl); + // load the image for this sheet + loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res) { + if (res.error) { + next(res.error); + return; + } + var spritesheet = new Spritesheet(res.texture, resource.data, resource.url); + spritesheet.parse(function () { + resource.spritesheet = spritesheet; + resource.textures = spritesheet.textures; + next(); + }); }); - }); - }; - - /** - * Get the spritesheets root path - * @param {PIXI.LoaderResource} resource - Resource to check path - * @param {string} baseUrl - Base root url - */ - SpritesheetLoader.getResourcePath = function getResourcePath (resource, baseUrl) - { - // Prepend url path unless the resource image is a data url - if (resource.isDataUrl) - { - return resource.data.meta.image; - } - - return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); - }; + }; + /** + * Get the spritesheets root path + * @param {PIXI.LoaderResource} resource - Resource to check path + * @param {string} baseUrl - Base root url + */ + SpritesheetLoader.getResourcePath = function (resource, baseUrl) { + // Prepend url path unless the resource image is a data url + if (resource.isDataUrl) { + return resource.data.meta.image; + } + return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image); + }; + return SpritesheetLoader; + }()); /*! - * @pixi/sprite-tiling - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/sprite-tiling - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/sprite-tiling is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var tempPoint$1 = new Point(); + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$9 = function(d, b) { + extendStatics$9 = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$9(d, b); + }; + + function __extends$9(d, b) { + extendStatics$9(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + var tempPoint$1 = new Point(); /** * A tiling sprite is a fast way of rendering a tiling image * @@ -42594,54 +38498,43 @@ var PIXI = (function (exports) { * @extends PIXI.Sprite * @memberof PIXI */ - var TilingSprite = /*@__PURE__*/(function (Sprite) { - function TilingSprite(texture, width, height) - { - if ( width === void 0 ) { width = 100; } - if ( height === void 0 ) { height = 100; } - - Sprite.call(this, texture); - + var TilingSprite = /** @class */ (function (_super) { + __extends$9(TilingSprite, _super); + /** + * @param {PIXI.Texture} texture - the texture of the tiling sprite + * @param {number} [width=100] - the width of the tiling sprite + * @param {number} [height=100] - the height of the tiling sprite + */ + function TilingSprite(texture, width, height) { + if (width === void 0) { width = 100; } + if (height === void 0) { height = 100; } + var _this = _super.call(this, texture) || this; /** * Tile transform * * @member {PIXI.Transform} */ - this.tileTransform = new Transform(); - - // /// private - + _this.tileTransform = new Transform(); /** * The with of the tiling sprite * * @member {number} * @private */ - this._width = width; - + _this._width = width; /** * The height of the tiling sprite * * @member {number} * @private */ - this._height = height; - - /** - * Canvas pattern - * - * @type {CanvasPattern} - * @private - */ - this._canvasPattern = null; - + _this._height = height; /** * matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space * * @member {PIXI.TextureMatrix} */ - this.uvMatrix = texture.uvMatrix || new TextureMatrix(texture); - + _this.uvMatrix = texture.uvMatrix || new TextureMatrix(texture); /** * Plugin that is responsible for rendering this element. * Allows to customize the rendering process without overriding '_render' method. @@ -42649,179 +38542,144 @@ var PIXI = (function (exports) { * @member {string} * @default 'tilingSprite' */ - this.pluginName = 'tilingSprite'; - + _this.pluginName = 'tilingSprite'; /** * Whether or not anchor affects uvs * * @member {boolean} * @default false */ - this.uvRespectAnchor = false; + _this.uvRespectAnchor = false; + return _this; } - - if ( Sprite ) { TilingSprite.__proto__ = Sprite; } - TilingSprite.prototype = Object.create( Sprite && Sprite.prototype ); - TilingSprite.prototype.constructor = TilingSprite; - - var prototypeAccessors = { clampMargin: { configurable: true },tileScale: { configurable: true },tilePosition: { configurable: true },width: { configurable: true },height: { configurable: true } }; + Object.defineProperty(TilingSprite.prototype, "clampMargin", { + /** + * Changes frame clamping in corresponding textureTransform, shortcut + * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas + * + * @default 0.5 + * @member {number} + */ + get: function () { + return this.uvMatrix.clampMargin; + }, + set: function (value) { + this.uvMatrix.clampMargin = value; + this.uvMatrix.update(true); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "tileScale", { + /** + * The scaling of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.tileTransform.scale; + }, + set: function (value) { + this.tileTransform.scale.copyFrom(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "tilePosition", { + /** + * The offset of the image that is being tiled + * + * @member {PIXI.ObservablePoint} + */ + get: function () { + return this.tileTransform.position; + }, + set: function (value) { + this.tileTransform.position.copyFrom(value); + }, + enumerable: false, + configurable: true + }); /** - * Changes frame clamping in corresponding textureTransform, shortcut - * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas - * - * @default 0.5 - * @member {number} + * @protected */ - prototypeAccessors.clampMargin.get = function () - { - return this.uvMatrix.clampMargin; - }; - - prototypeAccessors.clampMargin.set = function (value) // eslint-disable-line require-jsdoc - { - this.uvMatrix.clampMargin = value; - this.uvMatrix.update(true); - }; - - /** - * The scaling of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - prototypeAccessors.tileScale.get = function () - { - return this.tileTransform.scale; - }; - - prototypeAccessors.tileScale.set = function (value) // eslint-disable-line require-jsdoc - { - this.tileTransform.scale.copyFrom(value); - }; - - /** - * The offset of the image that is being tiled - * - * @member {PIXI.ObservablePoint} - */ - prototypeAccessors.tilePosition.get = function () - { - return this.tileTransform.position; - }; - - prototypeAccessors.tilePosition.set = function (value) // eslint-disable-line require-jsdoc - { - this.tileTransform.position.copyFrom(value); - }; - - /** - * @private - */ - TilingSprite.prototype._onTextureUpdate = function _onTextureUpdate () - { - if (this.uvMatrix) - { + TilingSprite.prototype._onTextureUpdate = function () { + if (this.uvMatrix) { this.uvMatrix.texture = this._texture; } this._cachedTint = 0xFFFFFF; }; - /** * Renders the object using the WebGL renderer * * @protected * @param {PIXI.Renderer} renderer - The renderer */ - TilingSprite.prototype._render = function _render (renderer) - { + TilingSprite.prototype._render = function (renderer) { // tweak our texture temporarily.. var texture = this._texture; - - if (!texture || !texture.valid) - { + if (!texture || !texture.valid) { return; } - this.tileTransform.updateLocalTransform(); this.uvMatrix.update(); - renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]); renderer.plugins[this.pluginName].render(this); }; - /** * Updates the bounds of the tiling sprite. * * @protected */ - TilingSprite.prototype._calculateBounds = function _calculateBounds () - { + TilingSprite.prototype._calculateBounds = function () { var minX = this._width * -this._anchor._x; var minY = this._height * -this._anchor._y; var maxX = this._width * (1 - this._anchor._x); var maxY = this._height * (1 - this._anchor._y); - this._bounds.addFrame(this.transform, minX, minY, maxX, maxY); }; - /** * Gets the local bounds of the sprite object. * * @param {PIXI.Rectangle} rect - The output rectangle. * @return {PIXI.Rectangle} The bounds. */ - TilingSprite.prototype.getLocalBounds = function getLocalBounds (rect) - { + TilingSprite.prototype.getLocalBounds = function (rect) { // we can do a fast local bounds if the sprite has no children! - if (this.children.length === 0) - { + if (this.children.length === 0) { this._bounds.minX = this._width * -this._anchor._x; this._bounds.minY = this._height * -this._anchor._y; this._bounds.maxX = this._width * (1 - this._anchor._x); this._bounds.maxY = this._height * (1 - this._anchor._y); - - if (!rect) - { - if (!this._localBoundsRect) - { + if (!rect) { + if (!this._localBoundsRect) { this._localBoundsRect = new Rectangle(); } - rect = this._localBoundsRect; } - return this._bounds.getRectangle(rect); } - - return Sprite.prototype.getLocalBounds.call(this, rect); + return _super.prototype.getLocalBounds.call(this, rect); }; - /** * Checks if a point is inside this tiling sprite. * - * @param {PIXI.Point} point - the point to check + * @param {PIXI.IPointData} point - the point to check * @return {boolean} Whether or not the sprite contains the point. */ - TilingSprite.prototype.containsPoint = function containsPoint (point) - { + TilingSprite.prototype.containsPoint = function (point) { this.worldTransform.applyInverse(point, tempPoint$1); - var width = this._width; var height = this._height; var x1 = -width * this.anchor._x; - - if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width) - { + if (tempPoint$1.x >= x1 && tempPoint$1.x < x1 + width) { var y1 = -height * this.anchor._y; - - if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height) - { + if (tempPoint$1.y >= y1 && tempPoint$1.y < y1 + height) { return true; } } - return false; }; - /** * Destroys this sprite and optionally its texture and children * @@ -42832,110 +38690,61 @@ var PIXI = (function (exports) { * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well */ - TilingSprite.prototype.destroy = function destroy (options) - { - Sprite.prototype.destroy.call(this, options); - + TilingSprite.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); this.tileTransform = null; this.uvMatrix = null; }; - /** * Helper function that creates a new tiling sprite based on the source you provide. * The source can be - frame id, image url, video url, canvas element, video element, base texture * * @static * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from - * @param {number} width - the width of the tiling sprite - * @param {number} height - the height of the tiling sprite + * @param {Object} options - See {@link PIXI.BaseTexture}'s constructor for options. + * @param {number} options.width - required width of the tiling sprite + * @param {number} options.height - required height of the tiling sprite * @return {PIXI.TilingSprite} The newly created texture */ - TilingSprite.from = function from (source, width, height) - { - return new TilingSprite(Texture.from(source), width, height); - }; - - /** - * Helper function that creates a tiling sprite that will use a texture from the TextureCache based on the frameId - * The frame ids are created when a Texture packer file has been loaded - * - * @static - * @param {string} frameId - The frame Id of the texture in the cache - * @param {number} width - the width of the tiling sprite - * @param {number} height - the height of the tiling sprite - * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the frameId - */ - TilingSprite.fromFrame = function fromFrame (frameId, width, height) - { - var texture = TextureCache[frameId]; - - if (!texture) - { - throw new Error(("The frameId \"" + frameId + "\" does not exist in the texture cache " + (this))); + TilingSprite.from = function (source, options) { + // Deprecated + if (typeof options === 'number') { + deprecation('5.3.0', 'TilingSprite.from use options instead of width and height args'); + // eslint-disable-next-line prefer-rest-params + options = { width: options, height: arguments[2] }; } - - return new TilingSprite(texture, width, height); + return new TilingSprite(Texture.from(source, options), options.width, options.height); }; - - /** - * Helper function that creates a sprite that will contain a texture based on an image url - * If the image is not in the texture cache it will be loaded - * - * @static - * @param {string} imageId - The image url of the texture - * @param {number} width - the width of the tiling sprite - * @param {number} height - the height of the tiling sprite - * @param {Object} [options] - See {@link PIXI.BaseTexture}'s constructor for options. - * @return {PIXI.TilingSprite} A new TilingSprite using a texture from the texture cache matching the image id - */ - TilingSprite.fromImage = function fromImage (imageId, width, height, options) - { - // Fallback support for crossorigin, scaleMode parameters - if (options && typeof options !== 'object') - { - options = { - scaleMode: arguments[4], - resourceOptions: { - crossorigin: arguments[3], - }, - }; - } - - return new TilingSprite(Texture.from(imageId, options), width, height); - }; - - /** - * The width of the sprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return this._width; - }; - - prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc - { - this._width = value; - }; - - /** - * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return this._height; - }; - - prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc - { - this._height = value; - }; - - Object.defineProperties( TilingSprite.prototype, prototypeAccessors ); - + Object.defineProperty(TilingSprite.prototype, "width", { + /** + * The width of the sprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this._width; + }, + set: function (value) { + this._width = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TilingSprite.prototype, "height", { + /** + * The height of the TilingSprite, setting this will actually modify the scale to achieve the value set + * + * @member {number} + */ + get: function () { + return this._height; + }, + set: function (value) { + this._height = value; + }, + enumerable: false, + configurable: true + }); return TilingSprite; }(Sprite)); @@ -42946,7 +38755,6 @@ var PIXI = (function (exports) { var fragmentSimple = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n"; var tempMat$1 = new Matrix(); - /** * WebGL renderer plugin for tiling sprites * @@ -42954,154 +38762,1698 @@ var PIXI = (function (exports) { * @memberof PIXI * @extends PIXI.ObjectRenderer */ - var TilingSpriteRenderer = /*@__PURE__*/(function (ObjectRenderer) { - function TilingSpriteRenderer(renderer) - { - ObjectRenderer.call(this, renderer); - - var uniforms = { globals: this.renderer.globalUniforms }; - - this.shader = Shader.from(vertex$2, fragment$2, uniforms); - - this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); - - this.quad = new QuadUv(); - + var TilingSpriteRenderer = /** @class */ (function (_super) { + __extends$9(TilingSpriteRenderer, _super); + /** + * constructor for renderer + * + * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for. + */ + function TilingSpriteRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + var uniforms = { globals: _this.renderer.globalUniforms }; + _this.shader = Shader.from(vertex$2, fragment$2, uniforms); + _this.simpleShader = Shader.from(vertex$2, fragmentSimple, uniforms); + _this.quad = new QuadUv(); /** * The WebGL state in which this renderer will work. * * @member {PIXI.State} * @readonly */ - this.state = State.for2d(); + _this.state = State.for2d(); + return _this; } - - if ( ObjectRenderer ) { TilingSpriteRenderer.__proto__ = ObjectRenderer; } - TilingSpriteRenderer.prototype = Object.create( ObjectRenderer && ObjectRenderer.prototype ); - TilingSpriteRenderer.prototype.constructor = TilingSpriteRenderer; - /** * - * @param {PIXI.TilingSprite} ts tilingSprite to be rendered + * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered */ - TilingSpriteRenderer.prototype.render = function render (ts) - { + TilingSpriteRenderer.prototype.render = function (ts) { var renderer = this.renderer; var quad = this.quad; - var vertices = quad.vertices; - vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x; vertices[1] = vertices[3] = ts._height * -ts.anchor.y; - vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x); vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y); - - if (ts.uvRespectAnchor) - { + if (ts.uvRespectAnchor) { vertices = quad.uvs; - vertices[0] = vertices[6] = -ts.anchor.x; vertices[1] = vertices[3] = -ts.anchor.y; - vertices[2] = vertices[4] = 1.0 - ts.anchor.x; vertices[5] = vertices[7] = 1.0 - ts.anchor.y; } - quad.invalidate(); - var tex = ts._texture; var baseTex = tex.baseTexture; var lt = ts.tileTransform.localTransform; var uv = ts.uvMatrix; var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height; - // auto, force repeat wrapMode for big tiling textures - if (isSimple) - { - if (!baseTex._glTextures[renderer.CONTEXT_UID]) - { - if (baseTex.wrapMode === exports.WRAP_MODES.CLAMP) - { + if (isSimple) { + if (!baseTex._glTextures[renderer.CONTEXT_UID]) { + if (baseTex.wrapMode === exports.WRAP_MODES.CLAMP) { baseTex.wrapMode = exports.WRAP_MODES.REPEAT; } } - else - { + else { isSimple = baseTex.wrapMode !== exports.WRAP_MODES.CLAMP; } } - var shader = isSimple ? this.simpleShader : this.shader; - var w = tex.width; var h = tex.height; var W = ts._width; var H = ts._height; - - tempMat$1.set(lt.a * w / W, - lt.b * w / H, - lt.c * h / W, - lt.d * h / H, - lt.tx / W, - lt.ty / H); - + tempMat$1.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H); // that part is the same as above: // tempMat.identity(); // tempMat.scale(tex.width, tex.height); // tempMat.prepend(lt); // tempMat.scale(1.0 / ts._width, 1.0 / ts._height); - tempMat$1.invert(); - if (isSimple) - { + if (isSimple) { tempMat$1.prepend(uv.mapCoord); } - else - { + else { shader.uniforms.uMapCoord = uv.mapCoord.toArray(true); shader.uniforms.uClampFrame = uv.uClampFrame; shader.uniforms.uClampOffset = uv.uClampOffset; } - shader.uniforms.uTransform = tempMat$1.toArray(true); - shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, - shader.uniforms.uColor, baseTex.alphaMode); + shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha, shader.uniforms.uColor, baseTex.alphaMode); shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true); shader.uniforms.uSampler = tex; - renderer.shader.bind(shader); - renderer.geometry.bind(quad);// , renderer.shader.getGLShader()); - + renderer.geometry.bind(quad); this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode); renderer.state.set(this.state); renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0); }; - return TilingSpriteRenderer; }(ObjectRenderer)); /*! - * @pixi/text-bitmap - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/mesh - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC + * + * @pixi/mesh is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */ + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$a = function(d, b) { + extendStatics$a = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$a(d, b); + }; + + function __extends$a(d, b) { + extendStatics$a(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /** + * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space. + * + * @class + * @memberof PIXI + */ + var MeshBatchUvs = /** @class */ (function () { + /** + * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's + * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix + */ + function MeshBatchUvs(uvBuffer, uvMatrix) { + /** + * Buffer with normalized UV's + * @member {PIXI.Buffer} + */ + this.uvBuffer = uvBuffer; + /** + * Material UV matrix + * @member {PIXI.TextureMatrix} + */ + this.uvMatrix = uvMatrix; + /** + * UV Buffer data + * @member {Float32Array} + * @readonly + */ + this.data = null; + this._bufferUpdateId = -1; + this._textureUpdateId = -1; + this._updateID = 0; + } + /** + * updates + * + * @param {boolean} [forceUpdate] - force the update + */ + MeshBatchUvs.prototype.update = function (forceUpdate) { + if (!forceUpdate + && this._bufferUpdateId === this.uvBuffer._updateID + && this._textureUpdateId === this.uvMatrix._updateID) { + return; + } + this._bufferUpdateId = this.uvBuffer._updateID; + this._textureUpdateId = this.uvMatrix._updateID; + var data = this.uvBuffer.data; + if (!this.data || this.data.length !== data.length) { + this.data = new Float32Array(data.length); + } + this.uvMatrix.multiplyUvs(data, this.data); + this._updateID++; + }; + return MeshBatchUvs; + }()); + + var tempPoint$2 = new Point(); + var tempPolygon = new Polygon(); + /** + * Base mesh class. + * + * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. + * This class assumes a certain level of WebGL knowledge. + * If you know a bit this should abstract enough away to make you life easier! + * + * Pretty much ALL WebGL can be broken down into the following: + * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. + * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) + * - State - This is the state of WebGL required to render the mesh. + * + * Through a combination of the above elements you can render anything you want, 2D or 3D! + * + * @class + * @extends PIXI.Container + * @memberof PIXI + */ + var Mesh = /** @class */ (function (_super) { + __extends$a(Mesh, _super); + /** + * @param {PIXI.Geometry} geometry - the geometry the mesh will use + * @param {PIXI.MeshMaterial} shader - the shader the mesh will use + * @param {PIXI.State} [state] - the state that the WebGL context is required to be in to render the mesh + * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS. + * @param {number} [drawMode=PIXI.DRAW_MODES.TRIANGLES] - the drawMode, can be any of the PIXI.DRAW_MODES consts + */ + function Mesh(geometry, shader, state, drawMode) { + if (drawMode === void 0) { drawMode = exports.DRAW_MODES.TRIANGLES; } + var _this = _super.call(this) || this; + /** + * Includes vertex positions, face indices, normals, colors, UVs, and + * custom attributes within buffers, reducing the cost of passing all + * this data to the GPU. Can be shared between multiple Mesh objects. + * @member {PIXI.Geometry} + * @readonly + */ + _this.geometry = geometry; + geometry.refCount++; + /** + * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. + * Can be shared between multiple Mesh objects. + * @member {PIXI.Shader|PIXI.MeshMaterial} + */ + _this.shader = shader; + /** + * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., + * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. + * @member {PIXI.State} + */ + _this.state = state || State.for2d(); + /** + * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. + * + * @member {number} + * @see PIXI.DRAW_MODES + */ + _this.drawMode = drawMode; + /** + * Typically the index of the IndexBuffer where to start drawing. + * @member {number} + * @default 0 + */ + _this.start = 0; + /** + * How much of the geometry to draw, by default `0` renders everything. + * @member {number} + * @default 0 + */ + _this.size = 0; + /** + * thease are used as easy access for batching + * @member {Float32Array} + * @private + */ + _this.uvs = null; + /** + * thease are used as easy access for batching + * @member {Uint16Array} + * @private + */ + _this.indices = null; + /** + * this is the caching layer used by the batcher + * @member {Float32Array} + * @private + */ + _this.vertexData = new Float32Array(1); + /** + * If geometry is changed used to decide to re-transform + * the vertexData. + * @member {number} + * @private + */ + _this.vertexDirty = 0; + _this._transformID = -1; + // Inherited from DisplayMode, set defaults + _this.tint = 0xFFFFFF; + _this.blendMode = exports.BLEND_MODES.NORMAL; + /** + * Internal roundPixels field + * + * @member {boolean} + * @private + */ + _this._roundPixels = settings.ROUND_PIXELS; + /** + * Batched UV's are cached for atlas textures + * @member {PIXI.MeshBatchUvs} + * @private + */ + _this.batchUvs = null; + return _this; + } + Object.defineProperty(Mesh.prototype, "uvBuffer", { + /** + * To change mesh uv's, change its uvBuffer data and increment its _updateID. + * @member {PIXI.Buffer} + * @readonly + */ + get: function () { + return this.geometry.buffers[1]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "verticesBuffer", { + /** + * To change mesh vertices, change its uvBuffer data and increment its _updateID. + * Incrementing _updateID is optional because most of Mesh objects do it anyway. + * @member {PIXI.Buffer} + * @readonly + */ + get: function () { + return this.geometry.buffers[0]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "material", { + get: function () { + return this.shader; + }, + /** + * Alias for {@link PIXI.Mesh#shader}. + * @member {PIXI.MeshMaterial} + */ + set: function (value) { + this.shader = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "blendMode", { + get: function () { + return this.state.blendMode; + }, + /** + * The blend mode to be applied to the Mesh. Apply a value of + * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL; + * @see PIXI.BLEND_MODES + */ + set: function (value) { + this.state.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "roundPixels", { + get: function () { + return this._roundPixels; + }, + /** + * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. + * Advantages can include sharper image quality (like text) and faster rendering on canvas. + * The main disadvantage is movement of objects may appear less smooth. + * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} + * + * @member {boolean} + * @default false + */ + set: function (value) { + if (this._roundPixels !== value) { + this._transformID = -1; + } + this._roundPixels = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "tint", { + /** + * The multiply tint applied to the Mesh. This is a hex value. A value of + * `0xFFFFFF` will remove any tint effect. + * + * @member {number} + * @default 0xFFFFFF + */ + get: function () { + return this.shader.tint; + }, + set: function (value) { + this.shader.tint = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Mesh.prototype, "texture", { + /** + * The texture that the Mesh uses. + * + * @member {PIXI.Texture} + */ + get: function () { + return this.shader.texture; + }, + set: function (value) { + this.shader.texture = value; + }, + enumerable: false, + configurable: true + }); + /** + * Standard renderer draw. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._render = function (renderer) { + // set properties for batching.. + // TODO could use a different way to grab verts? + var vertices = this.geometry.buffers[0].data; + // TODO benchmark check for attribute size.. + if (this.shader.batchable + && this.drawMode === exports.DRAW_MODES.TRIANGLES + && vertices.length < Mesh.BATCHABLE_SIZE * 2) { + this._renderToBatch(renderer); + } + else { + this._renderDefault(renderer); + } + }; + /** + * Standard non-batching way of rendering. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._renderDefault = function (renderer) { + var shader = this.shader; + shader.alpha = this.worldAlpha; + if (shader.update) { + shader.update(); + } + renderer.batch.flush(); + if (shader.program.uniformData.translationMatrix) { + shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true); + } + // bind and sync uniforms.. + renderer.shader.bind(shader); + // set state.. + renderer.state.set(this.state); + // bind the geometry... + renderer.geometry.bind(this.geometry, shader); + // then render it + renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount); + }; + /** + * Rendering by using the Batch system. + * @protected + * @param {PIXI.Renderer} renderer - Instance to renderer. + */ + Mesh.prototype._renderToBatch = function (renderer) { + var geometry = this.geometry; + if (this.shader.uvMatrix) { + this.shader.uvMatrix.update(); + this.calculateUvs(); + } + // set properties for batching.. + this.calculateVertices(); + this.indices = geometry.indexBuffer.data; + this._tintRGB = this.shader._tintRGB; + this._texture = this.shader.texture; + var pluginName = this.material.pluginName; + renderer.batch.setObjectRenderer(renderer.plugins[pluginName]); + renderer.plugins[pluginName].render(this); + }; + /** + * Updates vertexData field based on transform and vertices + */ + Mesh.prototype.calculateVertices = function () { + var geometry = this.geometry; + var vertices = geometry.buffers[0].data; + if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) { + return; + } + this._transformID = this.transform._worldID; + if (this.vertexData.length !== vertices.length) { + this.vertexData = new Float32Array(vertices.length); + } + var wt = this.transform.worldTransform; + var a = wt.a; + var b = wt.b; + var c = wt.c; + var d = wt.d; + var tx = wt.tx; + var ty = wt.ty; + var vertexData = this.vertexData; + for (var i = 0; i < vertexData.length / 2; i++) { + var x = vertices[(i * 2)]; + var y = vertices[(i * 2) + 1]; + vertexData[(i * 2)] = (a * x) + (c * y) + tx; + vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty; + } + if (this._roundPixels) { + var resolution = settings.RESOLUTION; + for (var i = 0; i < vertexData.length; ++i) { + vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution); + } + } + this.vertexDirty = geometry.vertexDirtyId; + }; + /** + * Updates uv field based on from geometry uv's or batchUvs + */ + Mesh.prototype.calculateUvs = function () { + var geomUvs = this.geometry.buffers[1]; + if (!this.shader.uvMatrix.isSimple) { + if (!this.batchUvs) { + this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix); + } + this.batchUvs.update(); + this.uvs = this.batchUvs.data; + } + else { + this.uvs = geomUvs.data; + } + }; + /** + * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. + * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. + * + * @protected + */ + Mesh.prototype._calculateBounds = function () { + this.calculateVertices(); + this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length); + }; + /** + * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES. + * + * @param {PIXI.IPointData} point - the point to test + * @return {boolean} the result of the test + */ + Mesh.prototype.containsPoint = function (point) { + if (!this.getBounds().contains(point.x, point.y)) { + return false; + } + this.worldTransform.applyInverse(point, tempPoint$2); + var vertices = this.geometry.getBuffer('aVertexPosition').data; + var points = tempPolygon.points; + var indices = this.geometry.getIndex().data; + var len = indices.length; + var step = this.drawMode === 4 ? 3 : 1; + for (var i = 0; i + 2 < len; i += step) { + var ind0 = indices[i] * 2; + var ind1 = indices[i + 1] * 2; + var ind2 = indices[i + 2] * 2; + points[0] = vertices[ind0]; + points[1] = vertices[ind0 + 1]; + points[2] = vertices[ind1]; + points[3] = vertices[ind1 + 1]; + points[4] = vertices[ind2]; + points[5] = vertices[ind2 + 1]; + if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y)) { + return true; + } + } + return false; + }; + /** + * Destroys the Mesh object. + * + * @param {object|boolean} [options] - Options parameter. A boolean will act as if all + * options have been set to that value + * @param {boolean} [options.children=false] - if set to true, all the children will have + * their destroy method called as well. 'options' will be passed on to those calls. + */ + Mesh.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.geometry.refCount--; + if (this.geometry.refCount === 0) { + this.geometry.dispose(); + } + this.geometry = null; + this.shader = null; + this.state = null; + this.uvs = null; + this.indices = null; + this.vertexData = null; + }; + /** + * The maximum number of vertices to consider batchable. Generally, the complexity + * of the geometry. + * @memberof PIXI.Mesh + * @static + * @member {number} BATCHABLE_SIZE + */ + Mesh.BATCHABLE_SIZE = 100; + return Mesh; + }(Container)); + + var fragment$3 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"; + + var vertex$3 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"; + + /** + * Slightly opinionated default shader for PixiJS 2D objects. + * @class + * @memberof PIXI + * @extends PIXI.Shader + */ + var MeshMaterial = /** @class */ (function (_super) { + __extends$a(MeshMaterial, _super); + /** + * @param {PIXI.Texture} uSampler - Texture that material uses to render. + * @param {object} [options] - Additional options + * @param {number} [options.alpha=1] - Default alpha. + * @param {number} [options.tint=0xFFFFFF] - Default tint. + * @param {string} [options.pluginName='batch'] - Renderer plugin for batching. + * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program. + * @param {object} [options.uniforms] - Custom uniforms. + */ + function MeshMaterial(uSampler, options) { + var _this = this; + var uniforms = { + uSampler: uSampler, + alpha: 1, + uTextureMatrix: Matrix.IDENTITY, + uColor: new Float32Array([1, 1, 1, 1]), + }; + // Set defaults + options = Object.assign({ + tint: 0xFFFFFF, + alpha: 1, + pluginName: 'batch', + }, options); + if (options.uniforms) { + Object.assign(uniforms, options.uniforms); + } + _this = _super.call(this, options.program || Program.from(vertex$3, fragment$3), uniforms) || this; + /** + * Only do update if tint or alpha changes. + * @member {boolean} + * @private + * @default false + */ + _this._colorDirty = false; + /** + * TextureMatrix instance for this Mesh, used to track Texture changes + * + * @member {PIXI.TextureMatrix} + * @readonly + */ + _this.uvMatrix = new TextureMatrix(uSampler); + /** + * `true` if shader can be batch with the renderer's batch system. + * @member {boolean} + * @default true + */ + _this.batchable = options.program === undefined; + /** + * Renderer plugin for batching + * + * @member {string} + * @default 'batch' + */ + _this.pluginName = options.pluginName; + _this.tint = options.tint; + _this.alpha = options.alpha; + return _this; + } + Object.defineProperty(MeshMaterial.prototype, "texture", { + /** + * Reference to the texture being rendered. + * @member {PIXI.Texture} + */ + get: function () { + return this.uniforms.uSampler; + }, + set: function (value) { + if (this.uniforms.uSampler !== value) { + this.uniforms.uSampler = value; + this.uvMatrix.texture = value; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MeshMaterial.prototype, "alpha", { + get: function () { + return this._alpha; + }, + /** + * This gets automatically set by the object using this. + * + * @default 1 + * @member {number} + */ + set: function (value) { + if (value === this._alpha) + { return; } + this._alpha = value; + this._colorDirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MeshMaterial.prototype, "tint", { + get: function () { + return this._tint; + }, + /** + * Multiply tint for the material. + * @member {number} + * @default 0xFFFFFF + */ + set: function (value) { + if (value === this._tint) + { return; } + this._tint = value; + this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); + this._colorDirty = true; + }, + enumerable: false, + configurable: true + }); + /** + * Gets called automatically by the Mesh. Intended to be overridden for custom + * MeshMaterial objects. + */ + MeshMaterial.prototype.update = function () { + if (this._colorDirty) { + this._colorDirty = false; + var baseTexture = this.texture.baseTexture; + premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode); + } + if (this.uvMatrix.update()) { + this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord; + } + }; + return MeshMaterial; + }(Shader)); + + /** + * Standard 2D geometry used in PixiJS. + * + * Geometry can be defined without passing in a style or data if required. + * + * ```js + * const geometry = new PIXI.Geometry(); + * + * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); + * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2); + * geometry.addIndex([0,1,2,1,3,2]); + * + * ``` + * @class + * @memberof PIXI + * @extends PIXI.Geometry + */ + var MeshGeometry = /** @class */ (function (_super) { + __extends$a(MeshGeometry, _super); + /** + * @param {Float32Array|number[]} [vertices] - Positional data on geometry. + * @param {Float32Array|number[]} [uvs] - Texture UVs. + * @param {Uint16Array|number[]} [index] - IndexBuffer + */ + function MeshGeometry(vertices, uvs, index) { + var _this = _super.call(this) || this; + var verticesBuffer = new Buffer(vertices); + var uvsBuffer = new Buffer(uvs, true); + var indexBuffer = new Buffer(index, true, true); + _this.addAttribute('aVertexPosition', verticesBuffer, 2, false, exports.TYPES.FLOAT) + .addAttribute('aTextureCoord', uvsBuffer, 2, false, exports.TYPES.FLOAT) + .addIndex(indexBuffer); + /** + * Dirty flag to limit update calls on Mesh. For example, + * limiting updates on a single Mesh instance with a shared Geometry + * within the render loop. + * @private + * @member {number} + * @default -1 + */ + _this._updateId = -1; + return _this; + } + Object.defineProperty(MeshGeometry.prototype, "vertexDirtyId", { + /** + * If the vertex position is updated. + * @member {number} + * @readonly + * @private + */ + get: function () { + return this.buffers[0]._updateID; + }, + enumerable: false, + configurable: true + }); + return MeshGeometry; + }(Geometry)); + + /*! + * @pixi/text-bitmap - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/text-bitmap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$b = function(d, b) { + extendStatics$b = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$b(d, b); + }; + + function __extends$b(d, b) { + extendStatics$b(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + /* eslint-disable max-len */ + /** + * Normalized parsed data from .fnt files. + * + * @class + * @memberof PIXI + */ + var BitmapFontData = /** @class */ (function () { + function BitmapFontData() { + /** + * @member {PIXI.IBitmapFontDataInfo[]} + * @readOnly + */ + this.info = []; + /** + * @member {PIXI.IBitmapFontDataCommon[]} + * @readOnly + */ + this.common = []; + /** + * @member {PIXI.IBitmapFontDataPage[]} + * @readOnly + */ + this.page = []; + /** + * @member {PIXI.IBitmapFontDataChar[]} + * @readOnly + */ + this.char = []; + /** + * @member {PIXI.IBitmapFontDataKerning[]} + * @readOnly + */ + this.kerning = []; + } + return BitmapFontData; + }()); + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataInfo + * @property {string} face + * @property {number} size + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataCommon + * @property {number} lineHeight + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataPage + * @property {number} id + * @property {string} file + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataChar + * @property {string} id + * @property {number} page + * @property {number} x + * @property {number} y + * @property {number} width + * @property {number} height + * @property {number} xoffset + * @property {number} yoffset + * @property {number} xadvance + */ + /** + * @memberof PIXI + * @typedef {object} IBitmapFontDataKerning + * @property {number} first + * @property {number} second + * @property {number} amount + */ + + /** + * BitmapFont format that's Text-based. + * + * @class + * @private + */ + var TextFormat = /** @class */ (function () { + function TextFormat() { + } + /** + * Check if resource refers to txt font data. + * + * @static + * @private + * @param {any} data + * @return {boolean} True if resource could be treated as font data, false otherwise. + */ + TextFormat.test = function (data) { + return typeof data === 'string' && data.indexOf('info face=') === 0; + }; + /** + * Convert text font data to a javascript object. + * + * @static + * @private + * @param {string} txt - Raw string data to be converted + * @return {PIXI.BitmapFontData} Parsed font data + */ + TextFormat.parse = function (txt) { + // Retrieve data item + var items = txt.match(/^[a-z]+\s+.+$/gm); + var rawData = { + info: [], + common: [], + page: [], + char: [], + chars: [], + kerning: [], + }; + for (var i in items) { + // Extract item name + var name = items[i].match(/^[a-z]+/gm)[0]; + // Extract item attribute list as string ex.: "width=10" + var attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm); + // Convert attribute list into an object + var itemData = {}; + for (var i_1 in attributeList) { + // Split key-value pairs + var split = attributeList[i_1].split('='); + var key = split[0]; + // Remove eventual quotes from value + var strValue = split[1].replace(/"/gm, ''); + // Try to convert value into float + var floatValue = parseFloat(strValue); + // Use string value case float value is NaN + var value = isNaN(floatValue) ? strValue : floatValue; + itemData[key] = value; + } + // Push current item to the resulting data + rawData[name].push(itemData); + } + var font = new BitmapFontData(); + rawData.info.forEach(function (info) { return font.info.push({ + face: info.face, + size: parseInt(info.size, 10), + }); }); + rawData.common.forEach(function (common) { return font.common.push({ + lineHeight: parseInt(common.lineHeight, 10), + }); }); + rawData.page.forEach(function (page) { return font.page.push({ + id: parseInt(page.id, 10), + file: page.file, + }); }); + rawData.char.forEach(function (char) { return font.char.push({ + id: parseInt(char.id, 10), + page: parseInt(char.page, 10), + x: parseInt(char.x, 10), + y: parseInt(char.y, 10), + width: parseInt(char.width, 10), + height: parseInt(char.height, 10), + xoffset: parseInt(char.xoffset, 10), + yoffset: parseInt(char.yoffset, 10), + xadvance: parseInt(char.xadvance, 10), + }); }); + rawData.kerning.forEach(function (kerning) { return font.kerning.push({ + first: parseInt(kerning.first, 10), + second: parseInt(kerning.second, 10), + amount: parseInt(kerning.amount, 10), + }); }); + return font; + }; + return TextFormat; + }()); + + /** + * BitmapFont format that's XML-based. + * + * @class + * @private + */ + var XMLFormat = /** @class */ (function () { + function XMLFormat() { + } + /** + * Check if resource refers to xml font data. + * + * @static + * @private + * @param {any} data + * @return {boolean} True if resource could be treated as font data, false otherwise. + */ + XMLFormat.test = function (data) { + return data instanceof XMLDocument + && data.getElementsByTagName('page').length + && data.getElementsByTagName('info')[0].getAttribute('face') !== null; + }; + /** + * Convert the XML into BitmapFontData that we can use. + * + * @static + * @private + * @param {XMLDocument} xml + * @return {BitmapFontData} Data to use for BitmapFont + */ + XMLFormat.parse = function (xml) { + var data = new BitmapFontData(); + var info = xml.getElementsByTagName('info'); + var common = xml.getElementsByTagName('common'); + var page = xml.getElementsByTagName('page'); + var char = xml.getElementsByTagName('char'); + var kerning = xml.getElementsByTagName('kerning'); + for (var i = 0; i < info.length; i++) { + data.info.push({ + face: info[i].getAttribute('face'), + size: parseInt(info[i].getAttribute('size'), 10), + }); + } + for (var i = 0; i < common.length; i++) { + data.common.push({ + lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10), + }); + } + for (var i = 0; i < page.length; i++) { + data.page.push({ + id: parseInt(page[i].getAttribute('id'), 10) || 0, + file: page[i].getAttribute('file'), + }); + } + for (var i = 0; i < char.length; i++) { + var letter = char[i]; + data.char.push({ + id: parseInt(letter.getAttribute('id'), 10), + page: parseInt(letter.getAttribute('page'), 10) || 0, + x: parseInt(letter.getAttribute('x'), 10), + y: parseInt(letter.getAttribute('y'), 10), + width: parseInt(letter.getAttribute('width'), 10), + height: parseInt(letter.getAttribute('height'), 10), + xoffset: parseInt(letter.getAttribute('xoffset'), 10), + yoffset: parseInt(letter.getAttribute('yoffset'), 10), + xadvance: parseInt(letter.getAttribute('xadvance'), 10), + }); + } + for (var i = 0; i < kerning.length; i++) { + data.kerning.push({ + first: parseInt(kerning[i].getAttribute('first'), 10), + second: parseInt(kerning[i].getAttribute('second'), 10), + amount: parseInt(kerning[i].getAttribute('amount'), 10), + }); + } + return data; + }; + return XMLFormat; + }()); + + // Registered formats, maybe make this extensible in the future? + var formats = [ + TextFormat, + XMLFormat ]; + /** + * Auto-detect BitmapFont parsing format based on data. + * @private + * @param {any} data - Data to detect format + * @return {any} Format or null + */ + function autoDetectFormat(data) { + for (var i = 0; i < formats.length; i++) { + if (formats[i].test(data)) { + return formats[i]; + } + } + return null; + } + + // TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle + /** + * Generates the fill style. Can automatically generate a gradient based on the fill style being an array + * + * @private + * @param {object} style - The style. + * @param {string[]} lines - The lines of text. + * @return {string|number|CanvasGradient} The fill style + */ + function generateFillStyle(canvas, context, style, resolution, lines, metrics) { + // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as + // the setter converts to string. See this thread for more details: + // https://github.com/microsoft/TypeScript/issues/2521 + var fillStyle = style.fill; + if (!Array.isArray(fillStyle)) { + return fillStyle; + } + else if (fillStyle.length === 1) { + return fillStyle[0]; + } + // the gradient will be evenly spaced out according to how large the array is. + // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75 + var gradient; + // a dropshadow will enlarge the canvas and result in the gradient being + // generated with the incorrect dimensions + var dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0; + // should also take padding into account, padding can offset the gradient + var padding = style.padding || 0; + var width = Math.ceil(canvas.width / resolution) - dropShadowCorrection - (padding * 2); + var height = Math.ceil(canvas.height / resolution) - dropShadowCorrection - (padding * 2); + // make a copy of the style settings, so we can manipulate them later + var fill = fillStyle.slice(); + var fillGradientStops = style.fillGradientStops.slice(); + // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75 + if (!fillGradientStops.length) { + var lengthPlus1 = fill.length + 1; + for (var i = 1; i < lengthPlus1; ++i) { + fillGradientStops.push(i / lengthPlus1); + } + } + // stop the bleeding of the last gradient on the line above to the top gradient of the this line + // by hard defining the first gradient colour at point 0, and last gradient colour at point 1 + fill.unshift(fillStyle[0]); + fillGradientStops.unshift(0); + fill.push(fillStyle[fillStyle.length - 1]); + fillGradientStops.push(1); + if (style.fillGradientType === exports.TEXT_GRADIENT.LINEAR_VERTICAL) { + // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas + gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding); + // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect + // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875 + // There's potential for floating point precision issues at the seams between gradient repeats. + // The loop below generates the stops in order, so track the last generated one to prevent + // floating point precision from making us go the teeniest bit backwards, resulting in + // the first and last colors getting swapped. + var lastIterationStop = 0; + // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc + var textHeight = metrics.fontProperties.fontSize + style.strokeThickness; + // textHeight, but as a 0-1 size in global gradient stop space + var gradStopLineHeight = textHeight / height; + for (var i = 0; i < lines.length; i++) { + var thisLineTop = metrics.lineHeight * i; + for (var j = 0; j < fill.length; j++) { + // 0-1 stop point for the current line, multiplied to global space afterwards + var lineStop = 0; + if (typeof fillGradientStops[j] === 'number') { + lineStop = fillGradientStops[j]; + } + else { + lineStop = j / fill.length; + } + var globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight); + // Prevent color stop generation going backwards from floating point imprecision + var clampedStop = Math.max(lastIterationStop, globalStop); + clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw. + gradient.addColorStop(clampedStop, fill[j]); + lastIterationStop = clampedStop; + } + } + } + else { + // start the gradient at the center left of the canvas, and end at the center right of the canvas + gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2); + // can just evenly space out the gradients in this case, as multiple lines makes no difference + // to an even left to right gradient + var totalIterations = fill.length + 1; + var currentIteration = 1; + for (var i = 0; i < fill.length; i++) { + var stop = void 0; + if (typeof fillGradientStops[i] === 'number') { + stop = fillGradientStops[i]; + } + else { + stop = currentIteration / totalIterations; + } + gradient.addColorStop(stop, fill[i]); + currentIteration++; + } + } + return gradient; + } + + // TODO: Prevent code duplication b/w drawGlyph & Text#updateText + /** + * Draws the glyph `metrics.text` on the given canvas. + * + * Ignored because not directly exposed. + * + * @ignore + * @param {HTMLCanvasElement} canvas + * @param {CanvasRenderingContext2D} context + * @param {TextMetrics} metrics + * @param {number} x + * @param {number} y + * @param {number} resolution + * @param {TextStyle} style + */ + function drawGlyph(canvas, context, metrics, x, y, resolution, style) { + var char = metrics.text; + var fontProperties = metrics.fontProperties; + context.translate(x, y); + context.scale(resolution, resolution); + var tx = style.strokeThickness / 2; + var ty = -(style.strokeThickness / 2); + context.font = style.toFontString(); + context.lineWidth = style.strokeThickness; + context.textBaseline = style.textBaseline; + context.lineJoin = style.lineJoin; + context.miterLimit = style.miterLimit; + // set canvas text styles + context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); + context.strokeStyle = style.stroke; + context.font = style.toFontString(); + context.lineWidth = style.strokeThickness; + context.textBaseline = style.textBaseline; + context.lineJoin = style.lineJoin; + context.miterLimit = style.miterLimit; + // set canvas text styles + context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics); + context.strokeStyle = style.stroke; + var dropShadowColor = style.dropShadowColor; + var rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor)); + if (style.dropShadow) { + context.shadowColor = "rgba(" + rgb[0] * 255 + "," + rgb[1] * 255 + "," + rgb[2] * 255 + "," + style.dropShadowAlpha + ")"; + context.shadowBlur = style.dropShadowBlur; + context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance; + context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance; + } + else { + context.shadowColor = '0'; + context.shadowBlur = 0; + context.shadowOffsetX = 0; + context.shadowOffsetY = 0; + } + if (style.stroke && style.strokeThickness) { + context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent); + } + if (style.fill) { + context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent); + } + context.setTransform(); + context.fillStyle = 'rgba(0, 0, 0, 0)'; + } + + /** + * Processes the passed character set data and returns a flattened array of all the characters. + * + * Ignored because not directly exposed. + * + * @ignore + * @param {string | string[] | string[][] } chars + * @returns {string[]} + */ + function resolveCharacters(chars) { + // Split the chars string into individual characters + if (typeof chars === 'string') { + chars = [chars]; + } + // Handle an array of characters+ranges + var result = []; + for (var i = 0, j = chars.length; i < j; i++) { + var item = chars[i]; + // Handle range delimited by start/end chars + if (Array.isArray(item)) { + if (item.length !== 2) { + throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got " + item.length + "."); + } + var startCode = item[0].charCodeAt(0); + var endCode = item[1].charCodeAt(0); + if (endCode < startCode) { + throw new Error('[BitmapFont]: Invalid character range.'); + } + for (var i_1 = startCode, j_1 = endCode; i_1 <= j_1; i_1++) { + result.push(String.fromCharCode(i_1)); + } + } + // Handle a character set string + else { + result.push.apply(result, item.split('')); + } + } + if (result.length === 0) { + throw new Error('[BitmapFont]: Empty set when resolving characters.'); + } + return result; + } + + /** + * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install` + * method for adding a font to be used. + * + * @class + * @memberof PIXI + */ + var BitmapFont = /** @class */ (function () { + /** + * @param {PIXI.BitmapFontData} data + * @param {PIXI.Texture[]|Object.} textures + */ + function BitmapFont(data, textures) { + var info = data.info[0]; + var common = data.common[0]; + var page = data.page[0]; + var res = getResolutionOfUrl(page.file); + var pageTextures = {}; + /** + * The name of the font face. + * + * @member {string} + * @readonly + */ + this.font = info.face; + /** + * The size of the font face in pixels. + * + * @member {number} + * @readonly + */ + this.size = info.size; + /** + * The line-height of the font face in pixels. + * + * @member {number} + * @readonly + */ + this.lineHeight = common.lineHeight / res; + /** + * The map of characters by character code. + * + * @member {object} + * @readonly + */ + this.chars = {}; + /** + * The map of base page textures (i.e., sheets of glyphs). + * + * @member {object} + * @readonly + * @private + */ + this.pageTextures = pageTextures; + // Convert the input Texture, Textures or object + // into a page Texture lookup by "id" + for (var i = 0; i < data.page.length; i++) { + var _a = data.page[i], id = _a.id, file = _a.file; + pageTextures[id] = textures instanceof Array + ? textures[i] : textures[file]; + } + // parse letters + for (var i = 0; i < data.char.length; i++) { + var _b = data.char[i], id = _b.id, page_1 = _b.page; + var _c = data.char[i], x = _c.x, y = _c.y, width = _c.width, height = _c.height, xoffset = _c.xoffset, yoffset = _c.yoffset, xadvance = _c.xadvance; + x /= res; + y /= res; + width /= res; + height /= res; + xoffset /= res; + yoffset /= res; + xadvance /= res; + var rect = new Rectangle(x + (pageTextures[page_1].frame.x / res), y + (pageTextures[page_1].frame.y / res), width, height); + this.chars[id] = { + xOffset: xoffset, + yOffset: yoffset, + xAdvance: xadvance, + kerning: {}, + texture: new Texture(pageTextures[page_1].baseTexture, rect), + page: page_1, + }; + } + // parse kernings + for (var i = 0; i < data.kerning.length; i++) { + var _d = data.kerning[i], first = _d.first, second = _d.second, amount = _d.amount; + first /= res; + second /= res; + amount /= res; + if (this.chars[second]) { + this.chars[second].kerning[first] = amount; + } + } + } + /** + * Remove references to created glyph textures. + */ + BitmapFont.prototype.destroy = function () { + for (var id in this.chars) { + this.chars[id].texture.destroy(); + this.chars[id].texture = null; + } + for (var id in this.pageTextures) { + this.pageTextures[id].destroy(true); + this.pageTextures[id] = null; + } + // Set readonly null. + this.chars = null; + this.pageTextures = null; + }; + /** + * Register a new bitmap font. + * + * @static + * @param {XMLDocument|string|PIXI.BitmapFontData} data - The + * characters map that could be provided as xml or raw string. + * @param {Object.|PIXI.Texture|PIXI.Texture[]} + * textures - List of textures for each page. + * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight + * and char fields. + */ + BitmapFont.install = function (data, textures) { + var fontData; + if (data instanceof BitmapFontData) { + fontData = data; + } + else { + var format = autoDetectFormat(data); + if (!format) { + throw new Error('Unrecognized data format for font.'); + } + fontData = format.parse(data); + } + // Single texture, convert to list + if (textures instanceof Texture) { + textures = [textures]; + } + var font = new BitmapFont(fontData, textures); + BitmapFont.available[font.font] = font; + return font; + }; + /** + * Remove bitmap font by name. + * + * @static + * @param {string} name + */ + BitmapFont.uninstall = function (name) { + var font = BitmapFont.available[name]; + if (!font) { + throw new Error("No font found named '" + name + "'"); + } + font.destroy(); + delete BitmapFont.available[name]; + }; + /** + * Generates a bitmap-font for the given style and character set. This does not support + * kernings yet. With `style` properties, only the following non-layout properties are used: + * + * - {@link PIXI.TextStyle#dropShadow|dropShadow} + * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance} + * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor} + * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur} + * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle} + * - {@link PIXI.TextStyle#fill|fill} + * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops} + * - {@link PIXI.TextStyle#fillGradientType|fillGradientType} + * - {@link PIXI.TextStyle#fontFamily|fontFamily} + * - {@link PIXI.TextStyle#fontSize|fontSize} + * - {@link PIXI.TextStyle#fontVariant|fontVariant} + * - {@link PIXI.TextStyle#fontWeight|fontWeight} + * - {@link PIXI.TextStyle#lineJoin|lineJoin} + * - {@link PIXI.TextStyle#miterLimit|miterLimit} + * - {@link PIXI.TextStyle#stroke|stroke} + * - {@link PIXI.TextStyle#strokeThickness|strokeThickness} + * - {@link PIXI.TextStyle#textBaseline|textBaseline} + * + * @param {string} name - The name of the custom font to use with BitmapText. + * @param {object|PIXI.TextStyle} [style] - Style options to render with BitmapFont. + * @param {PIXI.IBitmapFontOptions} [options] - Setup options for font or name of the font. + * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included + * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], "!@#$%^&*()~{}[] "]`. + * Don't forget to include spaces ' ' in your character set! + * @param {number} [options.resolution=1] - Render resolution for glyphs. + * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory. + * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory. + * @param {number} [options.padding=4] - Padding between glyphs on texture atlas. + * @return {PIXI.BitmapFont} Font generated by style options. + * @static + * @example + * PIXI.BitmapFont.from("TitleFont", { + * fontFamily: "Arial", + * fontSize: 12, + * strokeThickness: 2, + * fill: "purple" + * }); + * + * const title = new PIXI.BitmapText("This is the title", { fontName: "TitleFont" }); + */ + BitmapFont.from = function (name, textStyle, options) { + if (!name) { + throw new Error('[BitmapFont] Property `name` is required.'); + } + var _a = Object.assign({}, BitmapFont.defaultOptions, options), chars = _a.chars, padding = _a.padding, resolution = _a.resolution, textureWidth = _a.textureWidth, textureHeight = _a.textureHeight; + var charsList = resolveCharacters(chars); + var style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle); + var lineWidth = textureWidth; + var fontData = new BitmapFontData(); + fontData.info[0] = { + face: style.fontFamily, + size: style.fontSize, + }; + fontData.common[0] = { + lineHeight: style.fontSize, + }; + var positionX = 0; + var positionY = 0; + var canvas; + var context; + var baseTexture; + var maxCharHeight = 0; + var textures = []; + for (var i = 0; i < charsList.length; i++) { + if (!canvas) { + canvas = document.createElement('canvas'); + canvas.width = textureWidth; + canvas.height = textureHeight; + context = canvas.getContext('2d'); + baseTexture = new BaseTexture(canvas, { resolution: resolution }); + textures.push(new Texture(baseTexture)); + fontData.page.push({ + id: textures.length - 1, + file: '', + }); + } + // Measure glyph dimensions + var metrics = TextMetrics.measureText(charsList[i], style, false, canvas); + var width = metrics.width; + var height = Math.ceil(metrics.height); + // This is ugly - but italics are given more space so they don't overlap + var textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width); + // Can't fit char anymore: next canvas please! + if (positionY >= textureHeight - (height * resolution)) { + if (positionY === 0) { + // We don't want user debugging an infinite loop (or do we? :) + throw new Error("[BitmapFont] textureHeight " + textureHeight + "px is " + + ("too small for " + style.fontSize + "px fonts")); + } + --i; + // Create new atlas once current has filled up + canvas = null; + context = null; + baseTexture = null; + positionY = 0; + positionX = 0; + maxCharHeight = 0; + continue; + } + maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight); + // Wrap line once full row has been rendered + if ((textureGlyphWidth * resolution) + positionX >= lineWidth) { + --i; + positionY += maxCharHeight * resolution; + positionY = Math.ceil(positionY); + positionX = 0; + maxCharHeight = 0; + continue; + } + drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style); + // Unique (numeric) ID mapping to this glyph + var id = metrics.text.charCodeAt(0); + // Create a texture holding just the glyph + fontData.char.push({ + id: id, + page: textures.length - 1, + x: positionX / resolution, + y: positionY / resolution, + width: textureGlyphWidth, + height: height, + xoffset: 0, + yoffset: 0, + xadvance: Math.ceil(width + - (style.dropShadow ? style.dropShadowDistance : 0) + - (style.stroke ? style.strokeThickness : 0)), + }); + positionX += (textureGlyphWidth + (2 * padding)) * resolution; + positionX = Math.ceil(positionX); + } + var font = new BitmapFont(fontData, textures); + // Make it easier to replace a font + if (BitmapFont.available[name] !== undefined) { + BitmapFont.uninstall(name); + } + BitmapFont.available[name] = font; + return font; + }; + /** + * This character set includes all the letters in the alphabet (both lower- and upper- case). + * @readonly + * @static + * @member {string[][]} + * @example + * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.ALPHA }) + */ + BitmapFont.ALPHA = [['a', 'z'], ['A', 'Z'], ' ']; + /** + * This character set includes all decimal digits (from 0 to 9). + * @readonly + * @static + * @member {string[][]} + * @example + * BitmapFont.from("ExampleFont", style, { chars: BitmapFont.NUMERIC }) + */ + BitmapFont.NUMERIC = [['0', '9']]; + /** + * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`. + * @readonly + * @static + * @member {string[][]} + */ + BitmapFont.ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' ']; + /** + * This character set consists of all the ASCII table. + * @readonly + * @static + * @member {string[][]} + * @see http://www.asciitable.com/ + */ + BitmapFont.ASCII = [[' ', '~']]; + /** + * Collection of default options when using `BitmapFont.from`. + * + * @readonly + * @static + * @member {PIXI.IBitmapFontOptions} + * @property {number} resolution=1 + * @property {number} textureWidth=512 + * @property {number} textureHeight=512 + * @property {number} padding=4 + * @property {string|string[]|string[][]} chars=PIXI.BitmapFont.ALPHANUMERIC + */ + BitmapFont.defaultOptions = { + resolution: 1, + textureWidth: 512, + textureHeight: 512, + padding: 4, + chars: BitmapFont.ALPHANUMERIC, + }; + /** + * Collection of available/installed fonts. + * + * @readonly + * @static + * @member {Object.} + */ + BitmapFont.available = {}; + return BitmapFont; + }()); + /** + * @memberof PIXI + * @interface IBitmapFontOptions + * @property {string | string[] | string[][]} [chars=PIXI.BitmapFont.ALPHANUMERIC] - the character set to generate + * @property {number} [resolution=1] - the resolution for rendering + * @property {number} [padding=4] - the padding between glyphs in the atlas + * @property {number} [textureWidth=512] - the width of the texture atlas + * @property {number} [textureHeight=512] - the height of the texture atlas + */ + + var pageMeshDataPool = []; + var charRenderDataPool = []; /** * A BitmapText object will create a line or multiple lines of text using bitmap font. * * The primary advantage of this class over Text is that all of your textures are pre-generated and loading, * meaning that rendering is fast, and changing text has no performance implications. * - * The primary disadvantage is that you need to preload the bitmap font assets, and thus the styling is set in stone. * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters. * * To split a line you can use '\n', '\r' or '\r\n' in your string. * - * You can generate the fnt files using + * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by: * http://www.angelcode.com/products/bmfont/ for Windows or * http://www.bmglyph.com/ for Mac. * @@ -43116,67 +40468,89 @@ var PIXI = (function (exports) { * @extends PIXI.Container * @memberof PIXI */ - var BitmapText = /*@__PURE__*/(function (Container) { - function BitmapText(text, style) - { - var this$1 = this; - if ( style === void 0 ) { style = {}; } - - Container.call(this); - + var BitmapText = /** @class */ (function (_super) { + __extends$b(BitmapText, _super); + /** + * @param {string} text - A string that you would like the text to display. + * @param {object} style - The style parameters. + * @param {string} style.fontName - The installed BitmapFont name. + * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined, + *. this will default to the BitmapFont size. + * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'), + * does not affect single line text. + * @param {number} [style.tint=0xFFFFFF] - The tint color. + * @param {number} [style.letterSpacing=0] - The amount of spacing between letters. + * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping. + */ + function BitmapText(text, style) { + if (style === void 0) { style = {}; } + var _this = _super.call(this) || this; + _this._tint = 0xFFFFFF; + if (style.font) { + deprecation('5.3.0', 'PIXI.BitmapText constructor style.font property is deprecated.'); + _this._upgradeStyle(style); + } + // Apply the defaults + var _a = Object.assign({}, BitmapText.styleDefaults, style), align = _a.align, tint = _a.tint, maxWidth = _a.maxWidth, letterSpacing = _a.letterSpacing, fontName = _a.fontName, fontSize = _a.fontSize; + if (!BitmapFont.available[fontName]) { + throw new Error("Missing BitmapFont \"" + fontName + "\""); + } + /** + * Collection of page mesh data. + * + * @member {object} + * @private + */ + _this._activePagesMeshData = []; /** * Private tracker for the width of the overall text * * @member {number} * @private */ - this._textWidth = 0; - + _this._textWidth = 0; /** * Private tracker for the height of the overall text * * @member {number} * @private */ - this._textHeight = 0; - + _this._textHeight = 0; /** - * Private tracker for the letter sprite pool. + * Private tracker for the current text align. * - * @member {PIXI.Sprite[]} + * @member {string} * @private */ - this._glyphs = []; - + _this._align = align; /** - * Private tracker for the current style. + * Private tracker for the current tint. * - * @member {object} + * @member {number} * @private */ - this._font = { - tint: style.tint !== undefined ? style.tint : 0xFFFFFF, - align: style.align || 'left', - name: null, - size: 0, - }; - + _this._tint = tint; /** - * Private tracker for the current font. + * Private tracker for the current font name. * - * @member {object} + * @member {string} * @private */ - this.font = style.font; // run font setter - + _this._fontName = fontName; + /** + * Private tracker for the current font size. + * + * @member {number} + * @private + */ + _this._fontSize = fontSize || BitmapFont.available[fontName].size; /** * Private tracker for the current text. * * @member {string} * @private */ - this._text = text; - + _this._text = text; /** * The max width of this bitmap text in pixels. If the text provided is longer than the * value provided, line breaks will be automatically inserted in the last whitespace. @@ -43185,39 +40559,28 @@ var PIXI = (function (exports) { * @member {number} * @private */ - this._maxWidth = 0; - + _this._maxWidth = maxWidth; /** * The max line height. This is useful when trying to use the total height of the Text, - * ie: when trying to vertically align. + * ie: when trying to vertically align. (Internally used) * * @member {number} * @private */ - this._maxLineHeight = 0; - + _this._maxLineHeight = 0; /** * Letter spacing. This is useful for setting the space between characters. * @member {number} * @private */ - this._letterSpacing = 0; - + _this._letterSpacing = letterSpacing; /** * Text anchor. read-only * * @member {PIXI.ObservablePoint} * @private */ - this._anchor = new ObservablePoint(function () { this$1.dirty = true; }, this, 0, 0); - - /** - * The dirty state of this object. - * - * @member {boolean} - */ - this.dirty = false; - + _this._anchor = new ObservablePoint(function () { _this.dirty = true; }, _this, 0, 0); /** * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. * Advantages can include sharper image quality (like text) and faster rendering on canvas. @@ -43225,35 +40588,31 @@ var PIXI = (function (exports) { * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} * * @member {boolean} - * @default false + * @default PIXI.settings.ROUND_PIXELS */ - this.roundPixels = settings.ROUND_PIXELS; - - this.updateText(); + _this.roundPixels = settings.ROUND_PIXELS; + /** + * Set to `true` if the BitmapText needs to be redrawn. + * + * @member {boolean} + */ + _this.dirty = true; + return _this; } - - if ( Container ) { BitmapText.__proto__ = Container; } - BitmapText.prototype = Object.create( Container && Container.prototype ); - BitmapText.prototype.constructor = BitmapText; - - var prototypeAccessors = { tint: { configurable: true },align: { configurable: true },anchor: { configurable: true },font: { configurable: true },text: { configurable: true },maxWidth: { configurable: true },maxLineHeight: { configurable: true },textWidth: { configurable: true },letterSpacing: { configurable: true },textHeight: { configurable: true } }; - /** - * Renders text and updates it when needed - * - * @private + * Renders text and updates it when needed. This should only be called + * if the BitmapFont is regenerated. */ - BitmapText.prototype.updateText = function updateText () - { - var data = BitmapText.fonts[this._font.name]; - var scale = this._font.size / data.size; + BitmapText.prototype.updateText = function () { + var _a; + var data = BitmapFont.available[this._fontName]; + var scale = this._fontSize / data.size; var pos = new Point(); var chars = []; var lineWidths = []; var text = this._text.replace(/(?:\r\n|\r)/g, '\n') || ' '; var textLength = text.length; - var maxWidth = this._maxWidth * data.size / this._font.size; - + var maxWidth = this._maxWidth * data.size / this._fontSize; var prevCharCode = null; var lastLineWidth = 0; var maxLineWidth = 0; @@ -43262,484 +40621,515 @@ var PIXI = (function (exports) { var lastBreakWidth = 0; var spacesRemoved = 0; var maxLineHeight = 0; - - for (var i = 0; i < textLength; i++) - { + for (var i = 0; i < textLength; i++) { var charCode = text.charCodeAt(i); var char = text.charAt(i); - - if ((/(?:\s)/).test(char)) - { + if ((/(?:\s)/).test(char)) { lastBreakPos = i; lastBreakWidth = lastLineWidth; } - - if (char === '\r' || char === '\n') - { + if (char === '\r' || char === '\n') { lineWidths.push(lastLineWidth); maxLineWidth = Math.max(maxLineWidth, lastLineWidth); ++line; ++spacesRemoved; - pos.x = 0; pos.y += data.lineHeight; prevCharCode = null; continue; } - var charData = data.chars[charCode]; - - if (!charData) - { + if (!charData) { continue; } - - if (prevCharCode && charData.kerning[prevCharCode]) - { + if (prevCharCode && charData.kerning[prevCharCode]) { pos.x += charData.kerning[prevCharCode]; } - - chars.push({ - texture: charData.texture, - line: line, - charCode: charCode, - position: new Point(pos.x + charData.xOffset + (this._letterSpacing / 2), pos.y + charData.yOffset), - }); + var charRenderData = charRenderDataPool.pop() || { + texture: Texture.EMPTY, + line: 0, + charCode: 0, + position: new Point(), + }; + charRenderData.texture = charData.texture; + charRenderData.line = line; + charRenderData.charCode = charCode; + charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2); + charRenderData.position.y = pos.y + charData.yOffset; + chars.push(charRenderData); pos.x += charData.xAdvance + this._letterSpacing; lastLineWidth = pos.x; maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height)); prevCharCode = charCode; - - if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) - { + if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth) { ++spacesRemoved; removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos); i = lastBreakPos; lastBreakPos = -1; - lineWidths.push(lastBreakWidth); maxLineWidth = Math.max(maxLineWidth, lastBreakWidth); line++; - pos.x = 0; pos.y += data.lineHeight; prevCharCode = null; } } - var lastChar = text.charAt(text.length - 1); - - if (lastChar !== '\r' && lastChar !== '\n') - { - if ((/(?:\s)/).test(lastChar)) - { + if (lastChar !== '\r' && lastChar !== '\n') { + if ((/(?:\s)/).test(lastChar)) { lastLineWidth = lastBreakWidth; } - lineWidths.push(lastLineWidth); maxLineWidth = Math.max(maxLineWidth, lastLineWidth); } - var lineAlignOffsets = []; - - for (var i$1 = 0; i$1 <= line; i$1++) - { + for (var i = 0; i <= line; i++) { var alignOffset = 0; - - if (this._font.align === 'right') - { - alignOffset = maxLineWidth - lineWidths[i$1]; + if (this._align === 'right') { + alignOffset = maxLineWidth - lineWidths[i]; } - else if (this._font.align === 'center') - { - alignOffset = (maxLineWidth - lineWidths[i$1]) / 2; + else if (this._align === 'center') { + alignOffset = (maxLineWidth - lineWidths[i]) / 2; } - lineAlignOffsets.push(alignOffset); } - var lenChars = chars.length; - var tint = this.tint; - - for (var i$2 = 0; i$2 < lenChars; i$2++) - { - var c = this._glyphs[i$2]; // get the next glyph sprite - - if (c) - { - c.texture = chars[i$2].texture; + var pagesMeshData = {}; + var newPagesMeshData = []; + var activePagesMeshData = this._activePagesMeshData; + for (var i = 0; i < activePagesMeshData.length; i++) { + pageMeshDataPool.push(activePagesMeshData[i]); + } + for (var i = 0; i < lenChars; i++) { + var texture = chars[i].texture; + var baseTextureUid = texture.baseTexture.uid; + if (!pagesMeshData[baseTextureUid]) { + var pageMeshData = pageMeshDataPool.pop(); + if (!pageMeshData) { + var geometry = new MeshGeometry(); + var material = new MeshMaterial(Texture.EMPTY); + var mesh = new Mesh(geometry, material); + pageMeshData = { + index: 0, + indexCount: 0, + vertexCount: 0, + uvsCount: 0, + total: 0, + mesh: mesh, + vertices: null, + uvs: null, + indices: null, + }; + } + // reset data.. + pageMeshData.index = 0; + pageMeshData.indexCount = 0; + pageMeshData.vertexCount = 0; + pageMeshData.uvsCount = 0; + pageMeshData.total = 0; + // TODO need to get page texture here somehow.. + pageMeshData.mesh.texture = new Texture(texture.baseTexture); + pageMeshData.mesh.tint = this._tint; + newPagesMeshData.push(pageMeshData); + pagesMeshData[baseTextureUid] = pageMeshData; } - else - { - c = new Sprite(chars[i$2].texture); - c.roundPixels = this.roundPixels; - this._glyphs.push(c); - } - - c.position.x = (chars[i$2].position.x + lineAlignOffsets[chars[i$2].line]) * scale; - c.position.y = chars[i$2].position.y * scale; - c.scale.x = c.scale.y = scale; - c.tint = tint; - - if (!c.parent) - { - this.addChild(c); + pagesMeshData[baseTextureUid].total++; + } + // lets find any previously active pageMeshDatas that are no longer required for + // the updated text (if any), removed and return them to the pool. + for (var i = 0; i < activePagesMeshData.length; i++) { + if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1) { + this.removeChild(activePagesMeshData[i].mesh); } } - - // remove unnecessary children. - for (var i$3 = lenChars; i$3 < this._glyphs.length; ++i$3) - { - this.removeChild(this._glyphs[i$3]); + // next lets add any new meshes, that have not yet been added to this BitmapText + // we only add if its not already a child of this BitmapObject + for (var i = 0; i < newPagesMeshData.length; i++) { + if (newPagesMeshData[i].mesh.parent !== this) { + this.addChild(newPagesMeshData[i].mesh); + } + } + // active page mesh datas are set to be the new pages added. + this._activePagesMeshData = newPagesMeshData; + for (var i in pagesMeshData) { + var pageMeshData = pagesMeshData[i]; + var total = pageMeshData.total; + // lets only allocate new buffers if we can fit the new text in the current ones.. + // unless that is, we will be batching. Currently batching dose not respect the size property of mesh + if (!(((_a = pageMeshData.indices) === null || _a === void 0 ? void 0 : _a.length) > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2) { + pageMeshData.vertices = new Float32Array(4 * 2 * total); + pageMeshData.uvs = new Float32Array(4 * 2 * total); + pageMeshData.indices = new Uint16Array(6 * total); + } + // as a buffer maybe bigger than the current word, we set the size of the meshMaterial + // to match the number of letters needed + pageMeshData.mesh.size = 6 * total; + } + for (var i = 0; i < lenChars; i++) { + var char = chars[i]; + var xPos = (char.position.x + lineAlignOffsets[char.line]) * scale; + var yPos = char.position.y * scale; + var texture = char.texture; + var pageMesh = pagesMeshData[texture.baseTexture.uid]; + var textureFrame = texture.frame; + var textureUvs = texture._uvs; + var index = pageMesh.index++; + pageMesh.indices[(index * 6) + 0] = 0 + (index * 4); + pageMesh.indices[(index * 6) + 1] = 1 + (index * 4); + pageMesh.indices[(index * 6) + 2] = 2 + (index * 4); + pageMesh.indices[(index * 6) + 3] = 0 + (index * 4); + pageMesh.indices[(index * 6) + 4] = 2 + (index * 4); + pageMesh.indices[(index * 6) + 5] = 3 + (index * 4); + pageMesh.vertices[(index * 8) + 0] = xPos; + pageMesh.vertices[(index * 8) + 1] = yPos; + pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale); + pageMesh.vertices[(index * 8) + 3] = yPos; + pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale); + pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale); + pageMesh.vertices[(index * 8) + 6] = xPos; + pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale); + pageMesh.uvs[(index * 8) + 0] = textureUvs.x0; + pageMesh.uvs[(index * 8) + 1] = textureUvs.y0; + pageMesh.uvs[(index * 8) + 2] = textureUvs.x1; + pageMesh.uvs[(index * 8) + 3] = textureUvs.y1; + pageMesh.uvs[(index * 8) + 4] = textureUvs.x2; + pageMesh.uvs[(index * 8) + 5] = textureUvs.y2; + pageMesh.uvs[(index * 8) + 6] = textureUvs.x3; + pageMesh.uvs[(index * 8) + 7] = textureUvs.y3; } - this._textWidth = maxLineWidth * scale; this._textHeight = (pos.y + data.lineHeight) * scale; - - // apply anchor - if (this.anchor.x !== 0 || this.anchor.y !== 0) - { - for (var i$4 = 0; i$4 < lenChars; i$4++) - { - this._glyphs[i$4].x -= this._textWidth * this.anchor.x; - this._glyphs[i$4].y -= this._textHeight * this.anchor.y; + for (var i in pagesMeshData) { + var pageMeshData = pagesMeshData[i]; + // apply anchor + if (this.anchor.x !== 0 || this.anchor.y !== 0) { + var vertexCount = 0; + var anchorOffsetX = this._textWidth * this.anchor.x; + var anchorOffsetY = this._textHeight * this.anchor.y; + for (var i_1 = 0; i_1 < pageMeshData.total; i_1++) { + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + pageMeshData.vertices[vertexCount++] -= anchorOffsetX; + pageMeshData.vertices[vertexCount++] -= anchorOffsetY; + } } + this._maxLineHeight = maxLineHeight * scale; + var vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition'); + var textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord'); + var indexBuffer = pageMeshData.mesh.geometry.getIndex(); + vertexBuffer.data = pageMeshData.vertices; + textureBuffer.data = pageMeshData.uvs; + indexBuffer.data = pageMeshData.indices; + vertexBuffer.update(); + textureBuffer.update(); + indexBuffer.update(); + } + for (var i = 0; i < chars.length; i++) { + charRenderDataPool.push(chars[i]); } - this._maxLineHeight = maxLineHeight * scale; }; - /** * Updates the transform of this object * * @private */ - BitmapText.prototype.updateTransform = function updateTransform () - { + BitmapText.prototype.updateTransform = function () { this.validate(); this.containerUpdateTransform(); }; - /** * Validates text before calling parent's getLocalBounds * * @return {PIXI.Rectangle} The rectangular bounding area */ - BitmapText.prototype.getLocalBounds = function getLocalBounds () - { + BitmapText.prototype.getLocalBounds = function () { this.validate(); - - return Container.prototype.getLocalBounds.call(this); + return _super.prototype.getLocalBounds.call(this); }; - /** * Updates text when needed * * @private */ - BitmapText.prototype.validate = function validate () - { - if (this.dirty) - { + BitmapText.prototype.validate = function () { + if (this.dirty) { this.updateText(); this.dirty = false; } }; - - /** - * The tint of the BitmapText object. - * - * @member {number} - */ - prototypeAccessors.tint.get = function () - { - return this._font.tint; - }; - - prototypeAccessors.tint.set = function (value) // eslint-disable-line require-jsdoc - { - this._font.tint = (typeof value === 'number' && value >= 0) ? value : 0xFFFFFF; - - this.dirty = true; - }; - - /** - * The alignment of the BitmapText object. - * - * @member {string} - * @default 'left' - */ - prototypeAccessors.align.get = function () - { - return this._font.align; - }; - - prototypeAccessors.align.set = function (value) // eslint-disable-line require-jsdoc - { - this._font.align = value || 'left'; - - this.dirty = true; - }; - - /** - * The anchor sets the origin point of the text. - * - * The default is `(0,0)`, this means the text's origin is the top left. - * - * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. - * - * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. - * - * @member {PIXI.Point | number} - */ - prototypeAccessors.anchor.get = function () - { - return this._anchor; - }; - - prototypeAccessors.anchor.set = function (value) // eslint-disable-line require-jsdoc - { - if (typeof value === 'number') - { - this._anchor.set(value); - } - else - { - this._anchor.copyFrom(value); - } - }; - - /** - * The font descriptor of the BitmapText object. - * - * @member {object} - */ - prototypeAccessors.font.get = function () - { - return this._font; - }; - - prototypeAccessors.font.set = function (value) // eslint-disable-line require-jsdoc - { - if (!value) - { - return; - } - - if (typeof value === 'string') - { - value = value.split(' '); - - this._font.name = value.length === 1 ? value[0] : value.slice(1).join(' '); - this._font.size = value.length >= 2 ? parseInt(value[0], 10) : BitmapText.fonts[this._font.name].size; - } - else - { - this._font.name = value.name; - this._font.size = typeof value.size === 'number' ? value.size : parseInt(value.size, 10); - } - - this.dirty = true; - }; - - /** - * The text of the BitmapText object. - * - * @member {string} - */ - prototypeAccessors.text.get = function () - { - return this._text; - }; - - prototypeAccessors.text.set = function (text) // eslint-disable-line require-jsdoc - { - text = String(text === null || text === undefined ? '' : text); - - if (this._text === text) - { - return; - } - this._text = text; - this.dirty = true; - }; - - /** - * The max width of this bitmap text in pixels. If the text provided is longer than the - * value provided, line breaks will be automatically inserted in the last whitespace. - * Disable by setting the value to 0. - * - * @member {number} - */ - prototypeAccessors.maxWidth.get = function () - { - return this._maxWidth; - }; - - prototypeAccessors.maxWidth.set = function (value) // eslint-disable-line require-jsdoc - { - if (this._maxWidth === value) - { - return; - } - this._maxWidth = value; - this.dirty = true; - }; - - /** - * The max line height. This is useful when trying to use the total height of the Text, - * i.e. when trying to vertically align. - * - * @member {number} - * @readonly - */ - prototypeAccessors.maxLineHeight.get = function () - { - this.validate(); - - return this._maxLineHeight; - }; - - /** - * The width of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - prototypeAccessors.textWidth.get = function () - { - this.validate(); - - return this._textWidth; - }; - - /** - * Additional space between characters. - * - * @member {number} - */ - prototypeAccessors.letterSpacing.get = function () - { - return this._letterSpacing; - }; - - prototypeAccessors.letterSpacing.set = function (value) // eslint-disable-line require-jsdoc - { - if (this._letterSpacing !== value) - { - this._letterSpacing = value; + Object.defineProperty(BitmapText.prototype, "tint", { + /** + * The tint of the BitmapText object. + * + * @member {number} + * @default 0xffffff + */ + get: function () { + return this._tint; + }, + set: function (value) { + if (this._tint === value) + { return; } + this._tint = value; + for (var i = 0; i < this._activePagesMeshData.length; i++) { + this._activePagesMeshData[i].mesh.tint = value; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "align", { + /** + * The alignment of the BitmapText object. + * + * @member {string} + * @default 'left' + */ + get: function () { + return this._align; + }, + set: function (value) { + if (this._align !== value) { + this._align = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "fontName", { + /** + * The name of the BitmapFont. + * + * @member {string} + */ + get: function () { + return this._fontName; + }, + set: function (value) { + if (!BitmapFont.available[value]) { + throw new Error("Missing BitmapFont \"" + value + "\""); + } + if (this._fontName !== value) { + this._fontName = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "fontSize", { + /** + * The size of the font to display. + * + * @member {number} + */ + get: function () { + return this._fontSize; + }, + set: function (value) { + if (this._fontSize !== value) { + this._fontSize = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "anchor", { + /** + * The anchor sets the origin point of the text. + * + * The default is `(0,0)`, this means the text's origin is the top left. + * + * Setting the anchor to `(0.5,0.5)` means the text's origin is centered. + * + * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner. + * + * @member {PIXI.Point | number} + */ + get: function () { + return this._anchor; + }, + set: function (value) { + if (typeof value === 'number') { + this._anchor.set(value); + } + else { + this._anchor.copyFrom(value); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "text", { + /** + * The text of the BitmapText object. + * + * @member {string} + */ + get: function () { + return this._text; + }, + set: function (text) { + text = String(text === null || text === undefined ? '' : text); + if (this._text === text) { + return; + } + this._text = text; this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "maxWidth", { + /** + * The max width of this bitmap text in pixels. If the text provided is longer than the + * value provided, line breaks will be automatically inserted in the last whitespace. + * Disable by setting the value to 0. + * + * @member {number} + */ + get: function () { + return this._maxWidth; + }, + set: function (value) { + if (this._maxWidth === value) { + return; + } + this._maxWidth = value; + this.dirty = true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "maxLineHeight", { + /** + * The max line height. This is useful when trying to use the total height of the Text, + * i.e. when trying to vertically align. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._maxLineHeight; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "textWidth", { + /** + * The width of the overall text, different from fontSize, + * which is defined in the style object. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._textWidth; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "letterSpacing", { + /** + * Additional space between characters. + * + * @member {number} + */ + get: function () { + return this._letterSpacing; + }, + set: function (value) { + if (this._letterSpacing !== value) { + this._letterSpacing = value; + this.dirty = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BitmapText.prototype, "textHeight", { + /** + * The height of the overall text, different from fontSize, + * which is defined in the style object. + * + * @member {number} + * @readonly + */ + get: function () { + this.validate(); + return this._textHeight; + }, + enumerable: false, + configurable: true + }); + /** + * For backward compatibility, convert old style.font constructor param to fontName & fontSize properties. + * + * @private + * @deprecated since 5.3.0 + */ + BitmapText.prototype._upgradeStyle = function (style) { + if (typeof style.font === 'string') { + var valueSplit = style.font.split(' '); + style.fontName = valueSplit.length === 1 + ? valueSplit[0] + : valueSplit.slice(1).join(' '); + if (valueSplit.length >= 2) { + style.fontSize = parseInt(valueSplit[0], 10); + } + } + else { + style.fontName = style.font.name; + style.fontSize = typeof style.font.size === 'number' + ? style.font.size + : parseInt(style.font.size, 10); } }; - - /** - * The height of the overall text, different from fontSize, - * which is defined in the style object. - * - * @member {number} - * @readonly - */ - prototypeAccessors.textHeight.get = function () - { - this.validate(); - - return this._textHeight; - }; - /** * Register a bitmap font with data and a texture. * + * @deprecated since 5.3.0 + * @see PIXI.BitmapFont.install * @static - * @param {XMLDocument} xml - The XML document data. - * @param {Object.|PIXI.Texture|PIXI.Texture[]} textures - List of textures for each page. - * If providing an object, the key is the `` element's `file` attribute in the FNT file. - * @return {Object} Result font object with font, size, lineHeight and char fields. */ - BitmapText.registerFont = function registerFont (xml, textures) - { - var data = {}; - var info = xml.getElementsByTagName('info')[0]; - var common = xml.getElementsByTagName('common')[0]; - var pages = xml.getElementsByTagName('page'); - var res = getResolutionOfUrl(pages[0].getAttribute('file'), settings.RESOLUTION); - var pagesTextures = {}; - - data.font = info.getAttribute('face'); - data.size = parseInt(info.getAttribute('size'), 10); - data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) / res; - data.chars = {}; - - // Single texture, convert to list - if (textures instanceof Texture) - { - textures = [textures]; - } - - // Convert the input Texture, Textures or object - // into a page Texture lookup by "id" - for (var i = 0; i < pages.length; i++) - { - var id = pages[i].getAttribute('id'); - var file = pages[i].getAttribute('file'); - - pagesTextures[id] = textures instanceof Array ? textures[i] : textures[file]; - } - - // parse letters - var letters = xml.getElementsByTagName('char'); - - for (var i$1 = 0; i$1 < letters.length; i$1++) - { - var letter = letters[i$1]; - var charCode = parseInt(letter.getAttribute('id'), 10); - var page = letter.getAttribute('page') || 0; - var textureRect = new Rectangle( - (parseInt(letter.getAttribute('x'), 10) / res) + (pagesTextures[page].frame.x / res), - (parseInt(letter.getAttribute('y'), 10) / res) + (pagesTextures[page].frame.y / res), - parseInt(letter.getAttribute('width'), 10) / res, - parseInt(letter.getAttribute('height'), 10) / res - ); - - data.chars[charCode] = { - xOffset: parseInt(letter.getAttribute('xoffset'), 10) / res, - yOffset: parseInt(letter.getAttribute('yoffset'), 10) / res, - xAdvance: parseInt(letter.getAttribute('xadvance'), 10) / res, - kerning: {}, - texture: new Texture(pagesTextures[page].baseTexture, textureRect), - page: page, - }; - } - - // parse kernings - var kernings = xml.getElementsByTagName('kerning'); - - for (var i$2 = 0; i$2 < kernings.length; i$2++) - { - var kerning = kernings[i$2]; - var first = parseInt(kerning.getAttribute('first'), 10) / res; - var second = parseInt(kerning.getAttribute('second'), 10) / res; - var amount = parseInt(kerning.getAttribute('amount'), 10) / res; - - if (data.chars[second]) - { - data.chars[second].kerning[first] = amount; - } - } - - // I'm leaving this as a temporary fix so we can test the bitmap fonts in v3 - // but it's very likely to change - BitmapText.fonts[data.font] = data; - - return data; + BitmapText.registerFont = function (data, textures) { + deprecation('5.3.0', 'PIXI.BitmapText.registerFont is deprecated, use PIXI.BitmapFont.install'); + return BitmapFont.install(data, textures); + }; + Object.defineProperty(BitmapText, "fonts", { + /** + * Get the list of installed fonts. + * + * @see PIXI.BitmapFont.available + * @deprecated since 5.3.0 + * @static + * @readonly + * @member {Object.} + */ + get: function () { + deprecation('5.3.0', 'PIXI.BitmapText.fonts is deprecated, use PIXI.BitmapFont.available'); + return BitmapFont.available; + }, + enumerable: false, + configurable: true + }); + BitmapText.styleDefaults = { + align: 'left', + tint: 0xFFFFFF, + maxWidth: 0, + letterSpacing: 0, }; - - Object.defineProperties( BitmapText.prototype, prototypeAccessors ); - return BitmapText; }(Container)); - BitmapText.fonts = {}; - /** * {@link PIXI.Loader Loader} middleware for loading * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}. @@ -43747,176 +41137,165 @@ var PIXI = (function (exports) { * @memberof PIXI * @implements PIXI.ILoaderPlugin */ - var BitmapFontLoader = function BitmapFontLoader () {}; - - BitmapFontLoader.parse = function parse (resource, texture) - { - resource.bitmapFont = BitmapText.registerFont(resource.data, texture); - }; - - /** - * Called when the plugin is installed. - * - * @see PIXI.Loader.registerPlugin - */ - BitmapFontLoader.add = function add () - { - LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT); - }; - - /** - * Replacement for NodeJS's path.dirname - * @private - * @param {string} url Path to get directory for - */ - BitmapFontLoader.dirname = function dirname (url) - { - var dir = url - .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character - .replace(/\/$/, '') // replace trailing slash - .replace(/\/[^\/]*$/, ''); // remove everything after the last - - // File request is relative, use current directory - if (dir === url) - { - return '.'; + var BitmapFontLoader = /** @class */ (function () { + function BitmapFontLoader() { } - // Started with a slash - else if (dir === '') - { - return '/'; - } - - return dir; - }; - - /** - * Called after a resource is loaded. - * @see PIXI.Loader.loaderMiddleware - * @param {PIXI.LoaderResource} resource - * @param {function} next - */ - BitmapFontLoader.use = function use (resource, next) - { - // skip if no data or not xml data - if (!resource.data || resource.type !== LoaderResource.TYPE.XML) - { - next(); - - return; - } - - // skip if not bitmap font data, using some silly duck-typing - if (resource.data.getElementsByTagName('page').length === 0 - || resource.data.getElementsByTagName('info').length === 0 - || resource.data.getElementsByTagName('info')[0].getAttribute('face') === null - ) - { - next(); - - return; - } - - var xmlUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : ''; - - if (resource.isDataUrl) - { - if (xmlUrl === '.') - { - xmlUrl = ''; - } - - if (this.baseUrl && xmlUrl) - { - // if baseurl has a trailing slash then add one to xmlUrl so the replace works below - if (this.baseUrl.charAt(this.baseUrl.length - 1) === '/') - { - xmlUrl += '/'; - } - } - } - - // remove baseUrl from xmlUrl - xmlUrl = xmlUrl.replace(this.baseUrl, ''); - - // if there is an xmlUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. - if (xmlUrl && xmlUrl.charAt(xmlUrl.length - 1) !== '/') - { - xmlUrl += '/'; - } - - var pages = resource.data.getElementsByTagName('page'); - var textures = {}; - - // Handle completed, when the number of textures - // load is the same number as references in the fnt file - var completed = function (page) { - textures[page.metadata.pageFile] = page.texture; - - if (Object.keys(textures).length === pages.length) - { - BitmapFontLoader.parse(resource, textures); + /** + * Called when the plugin is installed. + * + * @see PIXI.Loader.registerPlugin + */ + BitmapFontLoader.add = function () { + LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT); + }; + /** + * Called after a resource is loaded. + * @see PIXI.Loader.loaderMiddleware + * @param {PIXI.LoaderResource} resource + * @param {function} next + */ + BitmapFontLoader.use = function (resource, next) { + var format = autoDetectFormat(resource.data); + // Resource was not recognised as any of the expected font data format + if (!format) { next(); + return; + } + var baseUrl = BitmapFontLoader.getBaseUrl(this, resource); + var data = format.parse(resource.data); + var textures = {}; + // Handle completed, when the number of textures + // load is the same number as references in the fnt file + var completed = function (page) { + textures[page.metadata.pageFile] = page.texture; + if (Object.keys(textures).length === data.page.length) { + resource.bitmapFont = BitmapFont.install(data, textures); + next(); + } + }; + for (var i = 0; i < data.page.length; ++i) { + var pageFile = data.page[i].file; + var url = baseUrl + pageFile; + var exists = false; + // incase the image is loaded outside + // using the same loader, resource will be available + for (var name in this.resources) { + var bitmapResource = this.resources[name]; + if (bitmapResource.url === url) { + bitmapResource.metadata.pageFile = pageFile; + if (bitmapResource.texture) { + completed(bitmapResource); + } + else { + bitmapResource.onAfterMiddleware.add(completed); + } + exists = true; + break; + } + } + // texture is not loaded, we'll attempt to add + // it to the load and add the texture to the list + if (!exists) { + // Standard loading options for images + var options = { + crossOrigin: resource.crossOrigin, + loadType: LoaderResource.LOAD_TYPE.IMAGE, + metadata: Object.assign({ pageFile: pageFile }, resource.metadata.imageMetadata), + parentResource: resource, + }; + this.add(url, options, completed); + } } }; - - for (var i = 0; i < pages.length; ++i) - { - var pageFile = pages[i].getAttribute('file'); - var url = xmlUrl + pageFile; - var exists = false; - - // incase the image is loaded outside - // using the same loader, resource will be available - for (var name in this.resources) - { - var bitmapResource = this.resources[name]; - - if (bitmapResource.url === url) - { - bitmapResource.metadata.pageFile = pageFile; - if (bitmapResource.texture) - { - completed(bitmapResource); + /** + * Get folder path from a resource + * @private + * @param {PIXI.Loader} loader + * @param {PIXI.LoaderResource} resource + * @return {string} + */ + BitmapFontLoader.getBaseUrl = function (loader, resource) { + var resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : ''; + if (resource.isDataUrl) { + if (resUrl === '.') { + resUrl = ''; + } + if (loader.baseUrl && resUrl) { + // if baseurl has a trailing slash then add one to resUrl so the replace works below + if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/') { + resUrl += '/'; } - else - { - bitmapResource.onAfterMiddleware.add(completed); - } - exists = true; - break; } } - - // texture is not loaded, we'll attempt to add - // it to the load and add the texture to the list - if (!exists) - { - // Standard loading options for images - var options = { - crossOrigin: resource.crossOrigin, - loadType: LoaderResource.LOAD_TYPE.IMAGE, - metadata: Object.assign( - { pageFile: pageFile }, - resource.metadata.imageMetadata - ), - parentResource: resource, - }; - - this.add(url, options, completed); + // remove baseUrl from resUrl + resUrl = resUrl.replace(loader.baseUrl, ''); + // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty. + if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/') { + resUrl += '/'; } - } - }; + return resUrl; + }; + /** + * Replacement for NodeJS's path.dirname + * @private + * @param {string} url - Path to get directory for + */ + BitmapFontLoader.dirname = function (url) { + var dir = url + .replace(/\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character + .replace(/\/$/, '') // replace trailing slash + .replace(/\/[^\/]*$/, ''); // remove everything after the last + // File request is relative, use current directory + if (dir === url) { + return '.'; + } + // Started with a slash + else if (dir === '') { + return '/'; + } + return dir; + }; + return BitmapFontLoader; + }()); /*! - * @pixi/filter-alpha - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-alpha - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-alpha is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var fragment$3 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n"; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$c = function(d, b) { + extendStatics$c = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$c(d, b); + }; + + function __extends$c(d, b) { + extendStatics$c(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$4 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n"; /** * Simplest filter - applies alpha. @@ -43935,92 +41314,93 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var AlphaFilter = /*@__PURE__*/(function (Filter) { - function AlphaFilter(alpha) - { - if ( alpha === void 0 ) { alpha = 1.0; } - - Filter.call(this, _default, fragment$3, { uAlpha: 1 }); - - this.alpha = alpha; - } - - if ( Filter ) { AlphaFilter.__proto__ = Filter; } - AlphaFilter.prototype = Object.create( Filter && Filter.prototype ); - AlphaFilter.prototype.constructor = AlphaFilter; - - var prototypeAccessors = { alpha: { configurable: true } }; - + var AlphaFilter = /** @class */ (function (_super) { + __extends$c(AlphaFilter, _super); /** - * Coefficient for alpha multiplication - * - * @member {number} - * @default 1 + * @param {number} [alpha=1] - Amount of alpha from 0 to 1, where 0 is transparent */ - prototypeAccessors.alpha.get = function () - { - return this.uniforms.uAlpha; - }; - - prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.uAlpha = value; - }; - - Object.defineProperties( AlphaFilter.prototype, prototypeAccessors ); - + function AlphaFilter(alpha) { + if (alpha === void 0) { alpha = 1.0; } + var _this = _super.call(this, _default, fragment$4, { uAlpha: 1 }) || this; + _this.alpha = alpha; + return _this; + } + Object.defineProperty(AlphaFilter.prototype, "alpha", { + /** + * Coefficient for alpha multiplication + * + * @member {number} + * @default 1 + */ + get: function () { + return this.uniforms.uAlpha; + }, + set: function (value) { + this.uniforms.uAlpha = value; + }, + enumerable: false, + configurable: true + }); return AlphaFilter; }(Filter)); /*! - * @pixi/filter-blur - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-blur - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-blur is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$d = function(d, b) { + extendStatics$d = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$d(d, b); + }; + + function __extends$d(d, b) { + extendStatics$d(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + var vertTemplate = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 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\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }"; - - function generateBlurVertSource(kernelSize, x) - { + function generateBlurVertSource(kernelSize, x) { var halfLength = Math.ceil(kernelSize / 2); - var vertSource = vertTemplate; - var blurLoop = ''; var template; - // let value; - - if (x) - { + if (x) { template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);'; } - else - { + else { template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);'; } - - for (var i = 0; i < kernelSize; i++) - { - var blur = template.replace('%index%', i); - - // value = i; - - // if(i >= halfLength) - // { - // value = kernelSize - i - 1; - // } - - blur = blur.replace('%sampleIndex%', ((i - (halfLength - 1)) + ".0")); - + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i.toString()); + blur = blur.replace('%sampleIndex%', i - (halfLength - 1) + ".0"); blurLoop += blur; blurLoop += '\n'; } - vertSource = vertSource.replace('%blur%', blurLoop); - vertSource = vertSource.replace('%size%', kernelSize); - + vertSource = vertSource.replace('%size%', kernelSize.toString()); return vertSource; } @@ -44032,51 +41412,469 @@ var PIXI = (function (exports) { 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641], 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448], }; - var fragTemplate$1 = [ 'varying vec2 vBlurTexCoords[%size%];', 'uniform sampler2D uSampler;', - 'void main(void)', '{', ' gl_FragColor = vec4(0.0);', ' %blur%', '}' ].join('\n'); - - function generateBlurFragSource(kernelSize) - { + function generateBlurFragSource(kernelSize) { var kernel = GAUSSIAN_VALUES[kernelSize]; var halfLength = kernel.length; - var fragSource = fragTemplate$1; - var blurLoop = ''; var template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;'; var value; - - for (var i = 0; i < kernelSize; i++) - { - var blur = template.replace('%index%', i); - + for (var i = 0; i < kernelSize; i++) { + var blur = template.replace('%index%', i.toString()); value = i; - - if (i >= halfLength) - { + if (i >= halfLength) { value = kernelSize - i - 1; } - - blur = blur.replace('%value%', kernel[value]); - + blur = blur.replace('%value%', kernel[value].toString()); blurLoop += blur; blurLoop += '\n'; } - fragSource = fragSource.replace('%blur%', blurLoop); - fragSource = fragSource.replace('%size%', kernelSize); - + fragSource = fragSource.replace('%size%', kernelSize.toString()); return fragSource; } + /** + * Different types of environments for WebGL. + * + * @static + * @memberof PIXI + * @name ENV + * @enum {number} + * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility + * with older / less advanced devices. If you experience unexplained flickering prefer this environment. + * @property {number} WEBGL - Version 1 of WebGL + * @property {number} WEBGL2 - Version 2 of WebGL + */ + var ENV; + (function (ENV) { + ENV[ENV["WEBGL_LEGACY"] = 0] = "WEBGL_LEGACY"; + ENV[ENV["WEBGL"] = 1] = "WEBGL"; + ENV[ENV["WEBGL2"] = 2] = "WEBGL2"; + })(ENV || (ENV = {})); + /** + * Constant to identify the Renderer Type. + * + * @static + * @memberof PIXI + * @name RENDERER_TYPE + * @enum {number} + * @property {number} UNKNOWN - Unknown render type. + * @property {number} WEBGL - WebGL render type. + * @property {number} CANVAS - Canvas render type. + */ + var RENDERER_TYPE; + (function (RENDERER_TYPE) { + RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; + RENDERER_TYPE[RENDERER_TYPE["WEBGL"] = 1] = "WEBGL"; + RENDERER_TYPE[RENDERER_TYPE["CANVAS"] = 2] = "CANVAS"; + })(RENDERER_TYPE || (RENDERER_TYPE = {})); + /** + * Bitwise OR of masks that indicate the buffers to be cleared. + * + * @static + * @memberof PIXI + * @name BUFFER_BITS + * @enum {number} + * @property {number} COLOR - Indicates the buffers currently enabled for color writing. + * @property {number} DEPTH - Indicates the depth buffer. + * @property {number} STENCIL - Indicates the stencil buffer. + */ + var BUFFER_BITS; + (function (BUFFER_BITS) { + BUFFER_BITS[BUFFER_BITS["COLOR"] = 16384] = "COLOR"; + BUFFER_BITS[BUFFER_BITS["DEPTH"] = 256] = "DEPTH"; + BUFFER_BITS[BUFFER_BITS["STENCIL"] = 1024] = "STENCIL"; + })(BUFFER_BITS || (BUFFER_BITS = {})); + /** + * Various blend modes supported by PIXI. + * + * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes. + * Anything else will silently act like NORMAL. + * + * @memberof PIXI + * @name BLEND_MODES + * @enum {number} + * @property {number} NORMAL + * @property {number} ADD + * @property {number} MULTIPLY + * @property {number} SCREEN + * @property {number} OVERLAY + * @property {number} DARKEN + * @property {number} LIGHTEN + * @property {number} COLOR_DODGE + * @property {number} COLOR_BURN + * @property {number} HARD_LIGHT + * @property {number} SOFT_LIGHT + * @property {number} DIFFERENCE + * @property {number} EXCLUSION + * @property {number} HUE + * @property {number} SATURATION + * @property {number} COLOR + * @property {number} LUMINOSITY + * @property {number} NORMAL_NPM + * @property {number} ADD_NPM + * @property {number} SCREEN_NPM + * @property {number} NONE + * @property {number} SRC_IN + * @property {number} SRC_OUT + * @property {number} SRC_ATOP + * @property {number} DST_OVER + * @property {number} DST_IN + * @property {number} DST_OUT + * @property {number} DST_ATOP + * @property {number} SUBTRACT + * @property {number} SRC_OVER + * @property {number} ERASE + * @property {number} XOR + */ + var BLEND_MODES; + (function (BLEND_MODES) { + BLEND_MODES[BLEND_MODES["NORMAL"] = 0] = "NORMAL"; + BLEND_MODES[BLEND_MODES["ADD"] = 1] = "ADD"; + BLEND_MODES[BLEND_MODES["MULTIPLY"] = 2] = "MULTIPLY"; + BLEND_MODES[BLEND_MODES["SCREEN"] = 3] = "SCREEN"; + BLEND_MODES[BLEND_MODES["OVERLAY"] = 4] = "OVERLAY"; + BLEND_MODES[BLEND_MODES["DARKEN"] = 5] = "DARKEN"; + BLEND_MODES[BLEND_MODES["LIGHTEN"] = 6] = "LIGHTEN"; + BLEND_MODES[BLEND_MODES["COLOR_DODGE"] = 7] = "COLOR_DODGE"; + BLEND_MODES[BLEND_MODES["COLOR_BURN"] = 8] = "COLOR_BURN"; + BLEND_MODES[BLEND_MODES["HARD_LIGHT"] = 9] = "HARD_LIGHT"; + BLEND_MODES[BLEND_MODES["SOFT_LIGHT"] = 10] = "SOFT_LIGHT"; + BLEND_MODES[BLEND_MODES["DIFFERENCE"] = 11] = "DIFFERENCE"; + BLEND_MODES[BLEND_MODES["EXCLUSION"] = 12] = "EXCLUSION"; + BLEND_MODES[BLEND_MODES["HUE"] = 13] = "HUE"; + BLEND_MODES[BLEND_MODES["SATURATION"] = 14] = "SATURATION"; + BLEND_MODES[BLEND_MODES["COLOR"] = 15] = "COLOR"; + BLEND_MODES[BLEND_MODES["LUMINOSITY"] = 16] = "LUMINOSITY"; + BLEND_MODES[BLEND_MODES["NORMAL_NPM"] = 17] = "NORMAL_NPM"; + BLEND_MODES[BLEND_MODES["ADD_NPM"] = 18] = "ADD_NPM"; + BLEND_MODES[BLEND_MODES["SCREEN_NPM"] = 19] = "SCREEN_NPM"; + BLEND_MODES[BLEND_MODES["NONE"] = 20] = "NONE"; + BLEND_MODES[BLEND_MODES["SRC_OVER"] = 0] = "SRC_OVER"; + BLEND_MODES[BLEND_MODES["SRC_IN"] = 21] = "SRC_IN"; + BLEND_MODES[BLEND_MODES["SRC_OUT"] = 22] = "SRC_OUT"; + BLEND_MODES[BLEND_MODES["SRC_ATOP"] = 23] = "SRC_ATOP"; + BLEND_MODES[BLEND_MODES["DST_OVER"] = 24] = "DST_OVER"; + BLEND_MODES[BLEND_MODES["DST_IN"] = 25] = "DST_IN"; + BLEND_MODES[BLEND_MODES["DST_OUT"] = 26] = "DST_OUT"; + BLEND_MODES[BLEND_MODES["DST_ATOP"] = 27] = "DST_ATOP"; + BLEND_MODES[BLEND_MODES["ERASE"] = 26] = "ERASE"; + BLEND_MODES[BLEND_MODES["SUBTRACT"] = 28] = "SUBTRACT"; + BLEND_MODES[BLEND_MODES["XOR"] = 29] = "XOR"; + })(BLEND_MODES || (BLEND_MODES = {})); + /** + * Various webgl draw modes. These can be used to specify which GL drawMode to use + * under certain situations and renderers. + * + * @memberof PIXI + * @static + * @name DRAW_MODES + * @enum {number} + * @property {number} POINTS + * @property {number} LINES + * @property {number} LINE_LOOP + * @property {number} LINE_STRIP + * @property {number} TRIANGLES + * @property {number} TRIANGLE_STRIP + * @property {number} TRIANGLE_FAN + */ + var DRAW_MODES; + (function (DRAW_MODES) { + DRAW_MODES[DRAW_MODES["POINTS"] = 0] = "POINTS"; + DRAW_MODES[DRAW_MODES["LINES"] = 1] = "LINES"; + DRAW_MODES[DRAW_MODES["LINE_LOOP"] = 2] = "LINE_LOOP"; + DRAW_MODES[DRAW_MODES["LINE_STRIP"] = 3] = "LINE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLES"] = 4] = "TRIANGLES"; + DRAW_MODES[DRAW_MODES["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; + DRAW_MODES[DRAW_MODES["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; + })(DRAW_MODES || (DRAW_MODES = {})); + /** + * Various GL texture/resources formats. + * + * @memberof PIXI + * @static + * @name FORMATS + * @enum {number} + * @property {number} RGBA=6408 + * @property {number} RGB=6407 + * @property {number} ALPHA=6406 + * @property {number} LUMINANCE=6409 + * @property {number} LUMINANCE_ALPHA=6410 + * @property {number} DEPTH_COMPONENT=6402 + * @property {number} DEPTH_STENCIL=34041 + */ + var FORMATS; + (function (FORMATS) { + FORMATS[FORMATS["RGBA"] = 6408] = "RGBA"; + FORMATS[FORMATS["RGB"] = 6407] = "RGB"; + FORMATS[FORMATS["ALPHA"] = 6406] = "ALPHA"; + FORMATS[FORMATS["LUMINANCE"] = 6409] = "LUMINANCE"; + FORMATS[FORMATS["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; + FORMATS[FORMATS["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; + FORMATS[FORMATS["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; + })(FORMATS || (FORMATS = {})); + /** + * Various GL target types. + * + * @memberof PIXI + * @static + * @name TARGETS + * @enum {number} + * @property {number} TEXTURE_2D=3553 + * @property {number} TEXTURE_CUBE_MAP=34067 + * @property {number} TEXTURE_2D_ARRAY=35866 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072 + * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073 + * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074 + */ + var TARGETS; + (function (TARGETS) { + TARGETS[TARGETS["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; + TARGETS[TARGETS["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; + TARGETS[TARGETS["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; + })(TARGETS || (TARGETS = {})); + /** + * Various GL data format types. + * + * @memberof PIXI + * @static + * @name TYPES + * @enum {number} + * @property {number} UNSIGNED_BYTE=5121 + * @property {number} UNSIGNED_SHORT=5123 + * @property {number} UNSIGNED_SHORT_5_6_5=33635 + * @property {number} UNSIGNED_SHORT_4_4_4_4=32819 + * @property {number} UNSIGNED_SHORT_5_5_5_1=32820 + * @property {number} FLOAT=5126 + * @property {number} HALF_FLOAT=36193 + */ + var TYPES; + (function (TYPES) { + TYPES[TYPES["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; + TYPES[TYPES["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; + TYPES[TYPES["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; + TYPES[TYPES["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; + TYPES[TYPES["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; + TYPES[TYPES["FLOAT"] = 5126] = "FLOAT"; + TYPES[TYPES["HALF_FLOAT"] = 36193] = "HALF_FLOAT"; + })(TYPES || (TYPES = {})); + /** + * The scale modes that are supported by pixi. + * + * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations. + * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability. + * + * @memberof PIXI + * @static + * @name SCALE_MODES + * @enum {number} + * @property {number} LINEAR Smooth scaling + * @property {number} NEAREST Pixelating scaling + */ + var SCALE_MODES; + (function (SCALE_MODES) { + SCALE_MODES[SCALE_MODES["NEAREST"] = 0] = "NEAREST"; + SCALE_MODES[SCALE_MODES["LINEAR"] = 1] = "LINEAR"; + })(SCALE_MODES || (SCALE_MODES = {})); + /** + * The wrap modes that are supported by pixi. + * + * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations. + * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability. + * If the texture is non power of two then clamp will be used regardless as WebGL can + * only use REPEAT if the texture is po2. + * + * This property only affects WebGL. + * + * @name WRAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} CLAMP - The textures uvs are clamped + * @property {number} REPEAT - The texture uvs tile and repeat + * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring + */ + var WRAP_MODES; + (function (WRAP_MODES) { + WRAP_MODES[WRAP_MODES["CLAMP"] = 33071] = "CLAMP"; + WRAP_MODES[WRAP_MODES["REPEAT"] = 10497] = "REPEAT"; + WRAP_MODES[WRAP_MODES["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; + })(WRAP_MODES || (WRAP_MODES = {})); + /** + * Mipmap filtering modes that are supported by pixi. + * + * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering. + * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`, + * or its `POW2` and texture dimensions are powers of 2. + * Due to platform restriction, `ON` option will work like `POW2` for webgl-1. + * + * This property only affects WebGL. + * + * @name MIPMAP_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} OFF - No mipmaps + * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2 + * @property {number} ON - Always generate mipmaps + */ + var MIPMAP_MODES; + (function (MIPMAP_MODES) { + MIPMAP_MODES[MIPMAP_MODES["OFF"] = 0] = "OFF"; + MIPMAP_MODES[MIPMAP_MODES["POW2"] = 1] = "POW2"; + MIPMAP_MODES[MIPMAP_MODES["ON"] = 2] = "ON"; + })(MIPMAP_MODES || (MIPMAP_MODES = {})); + /** + * How to treat textures with premultiplied alpha + * + * @name ALPHA_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that. + * Option for compressed and data textures that are created from typed arrays. + * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload. + * Default option, used for all loaded images. + * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied + * Example: spine atlases with `_pma` suffix. + * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA. + * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD. + * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA. + */ + var ALPHA_MODES; + (function (ALPHA_MODES) { + ALPHA_MODES[ALPHA_MODES["NPM"] = 0] = "NPM"; + ALPHA_MODES[ALPHA_MODES["UNPACK"] = 1] = "UNPACK"; + ALPHA_MODES[ALPHA_MODES["PMA"] = 2] = "PMA"; + ALPHA_MODES[ALPHA_MODES["NO_PREMULTIPLIED_ALPHA"] = 0] = "NO_PREMULTIPLIED_ALPHA"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ON_UPLOAD"] = 1] = "PREMULTIPLY_ON_UPLOAD"; + ALPHA_MODES[ALPHA_MODES["PREMULTIPLY_ALPHA"] = 2] = "PREMULTIPLY_ALPHA"; + })(ALPHA_MODES || (ALPHA_MODES = {})); + /** + * How to clear renderTextures in filter + * + * @name CLEAR_MODES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} BLEND - Preserve the information in the texture, blend above + * @property {number} CLEAR - Must use `gl.clear` operation + * @property {number} BLIT - Clear or blit it, depends on device and level of paranoia + * @property {number} NO - Alias for BLEND, same as `false` in earlier versions + * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions + * @property {number} AUTO - Alias for BLIT + */ + var CLEAR_MODES; + (function (CLEAR_MODES) { + CLEAR_MODES[CLEAR_MODES["NO"] = 0] = "NO"; + CLEAR_MODES[CLEAR_MODES["YES"] = 1] = "YES"; + CLEAR_MODES[CLEAR_MODES["AUTO"] = 2] = "AUTO"; + CLEAR_MODES[CLEAR_MODES["BLEND"] = 0] = "BLEND"; + CLEAR_MODES[CLEAR_MODES["CLEAR"] = 1] = "CLEAR"; + CLEAR_MODES[CLEAR_MODES["BLIT"] = 2] = "BLIT"; + })(CLEAR_MODES || (CLEAR_MODES = {})); + /** + * The gc modes that are supported by pixi. + * + * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO + * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not + * used for a specified period of time they will be removed from the GPU. They will of course + * be uploaded again when they are required. This is a silent behind the scenes process that + * should ensure that the GPU does not get filled up. + * + * Handy for mobile devices! + * This property only affects WebGL. + * + * @name GC_MODES + * @enum {number} + * @static + * @memberof PIXI + * @property {number} AUTO - Garbage collection will happen periodically automatically + * @property {number} MANUAL - Garbage collection will need to be called manually + */ + var GC_MODES; + (function (GC_MODES) { + GC_MODES[GC_MODES["AUTO"] = 0] = "AUTO"; + GC_MODES[GC_MODES["MANUAL"] = 1] = "MANUAL"; + })(GC_MODES || (GC_MODES = {})); + /** + * Constants that specify float precision in shaders. + * + * @name PRECISION + * @memberof PIXI + * @constant + * @static + * @enum {string} + * @property {string} LOW='lowp' + * @property {string} MEDIUM='mediump' + * @property {string} HIGH='highp' + */ + var PRECISION; + (function (PRECISION) { + PRECISION["LOW"] = "lowp"; + PRECISION["MEDIUM"] = "mediump"; + PRECISION["HIGH"] = "highp"; + })(PRECISION || (PRECISION = {})); + /** + * Constants for mask implementations. + * We use `type` suffix because it leads to very different behaviours + * + * @name MASK_TYPES + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - Mask is ignored + * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap + * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil + * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture + */ + var MASK_TYPES; + (function (MASK_TYPES) { + MASK_TYPES[MASK_TYPES["NONE"] = 0] = "NONE"; + MASK_TYPES[MASK_TYPES["SCISSOR"] = 1] = "SCISSOR"; + MASK_TYPES[MASK_TYPES["STENCIL"] = 2] = "STENCIL"; + MASK_TYPES[MASK_TYPES["SPRITE"] = 3] = "SPRITE"; + })(MASK_TYPES || (MASK_TYPES = {})); + /** + * Constants for multi-sampling antialiasing. + * + * @see PIXI.Framebuffer#multisample + * + * @name MSAA_QUALITY + * @memberof PIXI + * @static + * @enum {number} + * @property {number} NONE - No multisampling for this renderTexture + * @property {number} LOW - Try 2 samples + * @property {number} MEDIUM - Try 4 samples + * @property {number} HIGH - Try 8 samples + */ + var MSAA_QUALITY; + (function (MSAA_QUALITY) { + MSAA_QUALITY[MSAA_QUALITY["NONE"] = 0] = "NONE"; + MSAA_QUALITY[MSAA_QUALITY["LOW"] = 2] = "LOW"; + MSAA_QUALITY[MSAA_QUALITY["MEDIUM"] = 4] = "MEDIUM"; + MSAA_QUALITY[MSAA_QUALITY["HIGH"] = 8] = "HIGH"; + })(MSAA_QUALITY || (MSAA_QUALITY = {})); + /** * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object. * @@ -44084,138 +41882,123 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var BlurFilterPass = /*@__PURE__*/(function (Filter) { - function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) - { - kernelSize = kernelSize || 5; + var BlurFilterPass = /** @class */ (function (_super) { + __extends$d(BlurFilterPass, _super); + /** + * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`). + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution=1] - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurFilterPass(horizontal, strength, quality, resolution, kernelSize) { + if (strength === void 0) { strength = 8; } + if (quality === void 0) { quality = 4; } + if (resolution === void 0) { resolution = settings.RESOLUTION; } + if (kernelSize === void 0) { kernelSize = 5; } + var _this = this; var vertSrc = generateBlurVertSource(kernelSize, horizontal); var fragSrc = generateBlurFragSource(kernelSize); - - Filter.call( - // vertex shader - this, vertSrc, - // fragment shader - fragSrc - ); - - this.horizontal = horizontal; - - this.resolution = resolution || settings.RESOLUTION; - - this._quality = 0; - - this.quality = quality || 4; - - this.blur = strength || 8; + _this = _super.call(this, + // vertex shader + vertSrc, + // fragment shader + fragSrc) || this; + _this.horizontal = horizontal; + _this.resolution = resolution; + _this._quality = 0; + _this.quality = quality; + _this.blur = strength; + return _this; } - - if ( Filter ) { BlurFilterPass.__proto__ = Filter; } - BlurFilterPass.prototype = Object.create( Filter && Filter.prototype ); - BlurFilterPass.prototype.constructor = BlurFilterPass; - - var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true } }; - - BlurFilterPass.prototype.apply = function apply (filterManager, input, output, clear) - { - if (output) - { - if (this.horizontal) - { + /** + * Applies the filter. + * + * @param {PIXI.systems.FilterSystem} filterManager - The manager. + * @param {PIXI.RenderTexture} input - The input target. + * @param {PIXI.RenderTexture} output - The output target. + * @param {PIXI.CLEAR_MODES} clearMode - How to clear + */ + BlurFilterPass.prototype.apply = function (filterManager, input, output, clearMode) { + if (output) { + if (this.horizontal) { this.uniforms.strength = (1 / output.width) * (output.width / input.width); } - else - { + else { this.uniforms.strength = (1 / output.height) * (output.height / input.height); } } - else - { + else { if (this.horizontal) // eslint-disable-line - { + { this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width); } - else - { + else { this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line } } - // screen space! this.uniforms.strength *= this.strength; this.uniforms.strength /= this.passes; - - if (this.passes === 1) - { - filterManager.applyFilter(this, input, output, clear); + if (this.passes === 1) { + filterManager.applyFilter(this, input, output, clearMode); } - else - { + else { var renderTarget = filterManager.getFilterTexture(); var renderer = filterManager.renderer; - var flip = input; var flop = renderTarget; - this.state.blend = false; - filterManager.applyFilter(this, flip, flop, true); - - for (var i = 1; i < this.passes - 1; i++) - { - renderer.renderTexture.bind(flip, flip.filterFrame); - + filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR); + for (var i = 1; i < this.passes - 1; i++) { + filterManager.bindAndClear(flip, CLEAR_MODES.BLIT); this.uniforms.uSampler = flop; - var temp = flop; - flop = flip; flip = temp; - renderer.shader.bind(this); renderer.geometry.draw(5); } - this.state.blend = true; - filterManager.applyFilter(this, flop, output, clear); + filterManager.applyFilter(this, flop, output, clearMode); filterManager.returnFilterTexture(renderTarget); } }; - /** - * Sets the strength of both the blur. - * - * @member {number} - * @default 16 - */ - prototypeAccessors.blur.get = function () - { - return this.strength; - }; - - prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc - { - this.padding = 1 + (Math.abs(value) * 2); - this.strength = value; - }; - - /** - * Sets the quality of the blur by modifying the number of passes. More passes means higher - * quaility bluring but the lower the performance. - * - * @member {number} - * @default 4 - */ - prototypeAccessors.quality.get = function () - { - return this._quality; - }; - - prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc - { - this._quality = value; - this.passes = value; - }; - - Object.defineProperties( BlurFilterPass.prototype, prototypeAccessors ); - + Object.defineProperty(BlurFilterPass.prototype, "blur", { + /** + * Sets the strength of both the blur. + * + * @member {number} + * @default 16 + */ + get: function () { + return this.strength; + }, + set: function (value) { + this.padding = 1 + (Math.abs(value) * 2); + this.strength = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilterPass.prototype, "quality", { + /** + * Sets the quality of the blur by modifying the number of passes. More passes means higher + * quaility bluring but the lower the performance. + * + * @member {number} + * @default 4 + */ + get: function () { + return this._quality; + }, + set: function (value) { + this._quality = value; + this.passes = value; + }, + enumerable: false, + configurable: true + }); return BlurFilterPass; }(Filter)); @@ -44228,184 +42011,201 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var BlurFilter = /*@__PURE__*/(function (Filter) { - function BlurFilter(strength, quality, resolution, kernelSize) - { - Filter.call(this); - - this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize); - this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize); - - this.resolution = resolution || settings.RESOLUTION; - this.quality = quality || 4; - this.blur = strength || 8; - - this.repeatEdgePixels = false; + var BlurFilter = /** @class */ (function (_super) { + __extends$d(BlurFilter, _super); + /** + * @param {number} [strength=8] - The strength of the blur filter. + * @param {number} [quality=4] - The quality of the blur filter. + * @param {number} [resolution=1] - The resolution of the blur filter. + * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15. + */ + function BlurFilter(strength, quality, resolution, kernelSize) { + if (strength === void 0) { strength = 8; } + if (quality === void 0) { quality = 4; } + if (resolution === void 0) { resolution = settings.RESOLUTION; } + if (kernelSize === void 0) { kernelSize = 5; } + var _this = _super.call(this) || this; + _this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize); + _this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize); + _this.resolution = resolution; + _this.quality = quality; + _this.blur = strength; + _this.repeatEdgePixels = false; + return _this; } - - if ( Filter ) { BlurFilter.__proto__ = Filter; } - BlurFilter.prototype = Object.create( Filter && Filter.prototype ); - BlurFilter.prototype.constructor = BlurFilter; - - var prototypeAccessors = { blur: { configurable: true },quality: { configurable: true },blurX: { configurable: true },blurY: { configurable: true },blendMode: { configurable: true },repeatEdgePixels: { configurable: true } }; - /** * Applies the filter. * * @param {PIXI.systems.FilterSystem} filterManager - The manager. * @param {PIXI.RenderTexture} input - The input target. * @param {PIXI.RenderTexture} output - The output target. + * @param {PIXI.CLEAR_MODES} clearMode - How to clear */ - BlurFilter.prototype.apply = function apply (filterManager, input, output, clear) - { + BlurFilter.prototype.apply = function (filterManager, input, output, clearMode) { var xStrength = Math.abs(this.blurXFilter.strength); var yStrength = Math.abs(this.blurYFilter.strength); - - if (xStrength && yStrength) - { + if (xStrength && yStrength) { var renderTarget = filterManager.getFilterTexture(); - - this.blurXFilter.apply(filterManager, input, renderTarget, true); - this.blurYFilter.apply(filterManager, renderTarget, output, clear); - + this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR); + this.blurYFilter.apply(filterManager, renderTarget, output, clearMode); filterManager.returnFilterTexture(renderTarget); } - else if (yStrength) - { - this.blurYFilter.apply(filterManager, input, output, clear); + else if (yStrength) { + this.blurYFilter.apply(filterManager, input, output, clearMode); } - else - { - this.blurXFilter.apply(filterManager, input, output, clear); + else { + this.blurXFilter.apply(filterManager, input, output, clearMode); } }; - - BlurFilter.prototype.updatePadding = function updatePadding () - { - if (this._repeatEdgePixels) - { + BlurFilter.prototype.updatePadding = function () { + if (this._repeatEdgePixels) { this.padding = 0; } - else - { + else { this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2; } }; - - /** - * Sets the strength of both the blurX and blurY properties simultaneously - * - * @member {number} - * @default 2 - */ - prototypeAccessors.blur.get = function () - { - return this.blurXFilter.blur; - }; - - prototypeAccessors.blur.set = function (value) // eslint-disable-line require-jsdoc - { - this.blurXFilter.blur = this.blurYFilter.blur = value; - this.updatePadding(); - }; - - /** - * Sets the number of passes for blur. More passes means higher quaility bluring. - * - * @member {number} - * @default 1 - */ - prototypeAccessors.quality.get = function () - { - return this.blurXFilter.quality; - }; - - prototypeAccessors.quality.set = function (value) // eslint-disable-line require-jsdoc - { - this.blurXFilter.quality = this.blurYFilter.quality = value; - }; - - /** - * Sets the strength of the blurX property - * - * @member {number} - * @default 2 - */ - prototypeAccessors.blurX.get = function () - { - return this.blurXFilter.blur; - }; - - prototypeAccessors.blurX.set = function (value) // eslint-disable-line require-jsdoc - { - this.blurXFilter.blur = value; - this.updatePadding(); - }; - - /** - * Sets the strength of the blurY property - * - * @member {number} - * @default 2 - */ - prototypeAccessors.blurY.get = function () - { - return this.blurYFilter.blur; - }; - - prototypeAccessors.blurY.set = function (value) // eslint-disable-line require-jsdoc - { - this.blurYFilter.blur = value; - this.updatePadding(); - }; - - /** - * Sets the blendmode of the filter - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL - */ - prototypeAccessors.blendMode.get = function () - { - return this.blurYFilter.blendMode; - }; - - prototypeAccessors.blendMode.set = function (value) // eslint-disable-line require-jsdoc - { - this.blurYFilter.blendMode = value; - }; - - /** - * If set to true the edge of the target will be clamped - * - * @member {bool} - * @default false - */ - prototypeAccessors.repeatEdgePixels.get = function () - { - return this._repeatEdgePixels; - }; - - prototypeAccessors.repeatEdgePixels.set = function (value) - { - this._repeatEdgePixels = value; - this.updatePadding(); - }; - - Object.defineProperties( BlurFilter.prototype, prototypeAccessors ); - + Object.defineProperty(BlurFilter.prototype, "blur", { + /** + * Sets the strength of both the blurX and blurY properties simultaneously + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurXFilter.blur; + }, + set: function (value) { + this.blurXFilter.blur = this.blurYFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "quality", { + /** + * Sets the number of passes for blur. More passes means higher quaility bluring. + * + * @member {number} + * @default 1 + */ + get: function () { + return this.blurXFilter.quality; + }, + set: function (value) { + this.blurXFilter.quality = this.blurYFilter.quality = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blurX", { + /** + * Sets the strength of the blurX property + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurXFilter.blur; + }, + set: function (value) { + this.blurXFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blurY", { + /** + * Sets the strength of the blurY property + * + * @member {number} + * @default 2 + */ + get: function () { + return this.blurYFilter.blur; + }, + set: function (value) { + this.blurYFilter.blur = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "blendMode", { + /** + * Sets the blendmode of the filter + * + * @member {number} + * @default PIXI.BLEND_MODES.NORMAL + */ + get: function () { + return this.blurYFilter.blendMode; + }, + set: function (value) { + this.blurYFilter.blendMode = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BlurFilter.prototype, "repeatEdgePixels", { + /** + * If set to true the edge of the target will be clamped + * + * @member {boolean} + * @default false + */ + get: function () { + return this._repeatEdgePixels; + }, + set: function (value) { + this._repeatEdgePixels = value; + this.updatePadding(); + }, + enumerable: false, + configurable: true + }); return BlurFilter; }(Filter)); /*! - * @pixi/filter-color-matrix - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-color-matrix - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-color-matrix is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var fragment$4 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 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"; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$e = function(d, b) { + extendStatics$e = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$e(d, b); + }; + + function __extends$e(d, b) { + extendStatics$e(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$5 = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 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"; /** * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA @@ -44422,9 +42222,10 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var ColorMatrixFilter = /*@__PURE__*/(function (Filter) { - function ColorMatrixFilter() - { + var ColorMatrixFilter = /** @class */ (function (_super) { + __extends$e(ColorMatrixFilter, _super); + function ColorMatrixFilter() { + var _this = this; var uniforms = { m: new Float32Array([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, @@ -44432,18 +42233,10 @@ var PIXI = (function (exports) { 0, 0, 0, 1, 0]), uAlpha: 1, }; - - Filter.call(this, defaultFilter, fragment$4, uniforms); - - this.alpha = 1; + _this = _super.call(this, defaultFilter, fragment$5, uniforms) || this; + _this.alpha = 1; + return _this; } - - if ( Filter ) { ColorMatrixFilter.__proto__ = Filter; } - ColorMatrixFilter.prototype = Object.create( Filter && Filter.prototype ); - ColorMatrixFilter.prototype.constructor = ColorMatrixFilter; - - var prototypeAccessors = { matrix: { configurable: true },alpha: { configurable: true } }; - /** * Transforms current matrix and set the new one * @@ -44451,22 +42244,16 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype._loadMatrix = function _loadMatrix (matrix, multiply) - { - if ( multiply === void 0 ) { multiply = false; } - + ColorMatrixFilter.prototype._loadMatrix = function (matrix, multiply) { + if (multiply === void 0) { multiply = false; } var newMatrix = matrix; - - if (multiply) - { + if (multiply) { this._multiply(newMatrix, this.uniforms.m, matrix); newMatrix = this._colorMatrix(newMatrix); } - // set the new matrix this.uniforms.m = newMatrix; }; - /** * Multiplies two mat5's * @@ -44476,39 +42263,33 @@ var PIXI = (function (exports) { * @param {number[]} b - 5x4 matrix the second operand * @returns {number[]} 5x4 matrix */ - ColorMatrixFilter.prototype._multiply = function _multiply (out, a, b) - { + ColorMatrixFilter.prototype._multiply = function (out, a, b) { // Red Channel out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]); out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]); out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]); out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]); out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4]; - // Green Channel out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]); out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]); out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]); out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]); out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9]; - // Blue Channel out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]); out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]); out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]); out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]); out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14]; - // Alpha Channel out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]); out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]); out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]); out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]); out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19]; - return out; }; - /** * Create a Float32 Array and normalize the offset component to 0-1 * @@ -44516,19 +42297,15 @@ var PIXI = (function (exports) { * @param {number[]} matrix - 5x4 matrix * @return {number[]} 5x4 matrix with all values between 0-1 */ - ColorMatrixFilter.prototype._colorMatrix = function _colorMatrix (matrix) - { + ColorMatrixFilter.prototype._colorMatrix = function (matrix) { // Create a Float32 Array and normalize the offset component to 0-1 var m = new Float32Array(matrix); - m[4] /= 255; m[9] /= 255; m[14] /= 255; m[19] /= 255; - return m; }; - /** * Adjusts brightness * @@ -44536,17 +42313,14 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.brightness = function brightness (b, multiply) - { + ColorMatrixFilter.prototype.brightness = function (b, multiply) { var matrix = [ b, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Set the matrices in grey scales * @@ -44554,34 +42328,28 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.greyscale = function greyscale (scale, multiply) - { + ColorMatrixFilter.prototype.greyscale = function (scale, multiply) { var matrix = [ scale, scale, scale, 0, 0, scale, scale, scale, 0, 0, scale, scale, scale, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Set the black and white matrice. * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.blackAndWhite = function blackAndWhite (multiply) - { + ColorMatrixFilter.prototype.blackAndWhite = function (multiply) { var matrix = [ 0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0.3, 0.6, 0.1, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Set the hue property of the color * @@ -44589,14 +42357,11 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.hue = function hue (rotation, multiply) - { + ColorMatrixFilter.prototype.hue = function (rotation, multiply) { rotation = (rotation || 0) / 180 * Math.PI; - var cosR = Math.cos(rotation); var sinR = Math.sin(rotation); var sqrt = Math.sqrt; - /* a good approximation for hue rotation This matrix is far better than the versions with magic luminance constants formerly used here, but also used in the starling framework (flash) and known from this @@ -44609,31 +42374,24 @@ var PIXI = (function (exports) { This is the source for the code: see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751 */ - var w = 1 / 3; var sqrW = sqrt(w); // weight is - var a00 = cosR + ((1.0 - cosR) * w); var a01 = (w * (1.0 - cosR)) - (sqrW * sinR); var a02 = (w * (1.0 - cosR)) + (sqrW * sinR); - var a10 = (w * (1.0 - cosR)) + (sqrW * sinR); var a11 = cosR + (w * (1.0 - cosR)); var a12 = (w * (1.0 - cosR)) - (sqrW * sinR); - var a20 = (w * (1.0 - cosR)) - (sqrW * sinR); var a21 = (w * (1.0 - cosR)) + (sqrW * sinR); var a22 = cosR + (w * (1.0 - cosR)); - var matrix = [ a00, a01, a02, 0, 0, a10, a11, a12, 0, 0, a20, a21, a22, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Set the contrast matrix, increase the separation between dark and bright * Increase contrast : shadows darker and highlights brighter @@ -44643,225 +42401,184 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.contrast = function contrast (amount, multiply) - { + ColorMatrixFilter.prototype.contrast = function (amount, multiply) { var v = (amount || 0) + 1; var o = -0.5 * (v - 1); - var matrix = [ v, 0, 0, 0, o, 0, v, 0, 0, o, 0, 0, v, 0, o, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Set the saturation matrix, increase the separation between colors * Increase saturation : increase contrast, brightness, and sharpness * * @param {number} amount - The saturation amount (0-1) - * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, + * @param {boolean} [multiply] - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.saturate = function saturate (amount, multiply) - { - if ( amount === void 0 ) { amount = 0; } - + ColorMatrixFilter.prototype.saturate = function (amount, multiply) { + if (amount === void 0) { amount = 0; } var x = (amount * 2 / 3) + 1; var y = ((x - 1) * -0.5); - var matrix = [ x, y, y, 0, 0, y, x, y, 0, 0, y, y, x, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Desaturate image (remove color) * * Call the saturate function * */ - ColorMatrixFilter.prototype.desaturate = function desaturate () // eslint-disable-line no-unused-vars - { + ColorMatrixFilter.prototype.desaturate = function () { this.saturate(-1); }; - /** * Negative image (inverse of classic rgb matrix) * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.negative = function negative (multiply) - { + ColorMatrixFilter.prototype.negative = function (multiply) { var matrix = [ -1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Sepia image * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.sepia = function sepia (multiply) - { + ColorMatrixFilter.prototype.sepia = function (multiply) { var matrix = [ 0.393, 0.7689999, 0.18899999, 0, 0, 0.349, 0.6859999, 0.16799999, 0, 0, 0.272, 0.5339999, 0.13099999, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Color motion picture process invented in 1916 (thanks Dominic Szablewski) * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.technicolor = function technicolor (multiply) - { + ColorMatrixFilter.prototype.technicolor = function (multiply) { var matrix = [ 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337, -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398, -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Polaroid filter * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.polaroid = function polaroid (multiply) - { + ColorMatrixFilter.prototype.polaroid = function (multiply) { var matrix = [ 1.438, -0.062, -0.062, 0, 0, -0.122, 1.378, -0.122, 0, 0, -0.016, -0.016, 1.483, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Filter who transforms : Red -> Blue and Blue -> Red * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.toBGR = function toBGR (multiply) - { + ColorMatrixFilter.prototype.toBGR = function (multiply) { var matrix = [ 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski) * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.kodachrome = function kodachrome (multiply) - { + ColorMatrixFilter.prototype.kodachrome = function (multiply) { var matrix = [ 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502, -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203, -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Brown delicious browni filter (thanks Dominic Szablewski) * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.browni = function browni (multiply) - { + ColorMatrixFilter.prototype.browni = function (multiply) { var matrix = [ 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873, -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127, 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Vintage filter (thanks Dominic Szablewski) * * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.vintage = function vintage (multiply) - { + ColorMatrixFilter.prototype.vintage = function (multiply) { var matrix = [ 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123, 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591, 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * We don't know exactly what it does, kind of gradient map, but funny to play with! * * @param {number} desaturation - Tone values. * @param {number} toned - Tone values. - * @param {string} lightColor - Tone values, example: `0xFFE580` - * @param {string} darkColor - Tone values, example: `0xFFE580` + * @param {number} lightColor - Tone values, example: `0xFFE580` + * @param {number} darkColor - Tone values, example: `0xFFE580` * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.colorTone = function colorTone (desaturation, toned, lightColor, darkColor, multiply) - { + ColorMatrixFilter.prototype.colorTone = function (desaturation, toned, lightColor, darkColor, multiply) { desaturation = desaturation || 0.2; toned = toned || 0.15; lightColor = lightColor || 0xFFE580; darkColor = darkColor || 0x338000; - var lR = ((lightColor >> 16) & 0xFF) / 255; var lG = ((lightColor >> 8) & 0xFF) / 255; var lB = (lightColor & 0xFF) / 255; - var dR = ((darkColor >> 16) & 0xFF) / 255; var dG = ((darkColor >> 8) & 0xFF) / 255; var dB = (darkColor & 0xFF) / 255; - var matrix = [ 0.3, 0.59, 0.11, 0, 0, lR, lG, lB, desaturation, 0, dR, dG, dB, toned, 0, lR - dR, lG - dG, lB - dB, 0, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Night effect * @@ -44869,18 +42586,15 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.night = function night (intensity, multiply) - { + ColorMatrixFilter.prototype.night = function (intensity, multiply) { intensity = intensity || 0.1; var matrix = [ intensity * (-2.0), -intensity, 0, 0, 0, -intensity, 0, intensity, 0, 0, 0, intensity, intensity * 2.0, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Predator effect * @@ -44890,8 +42604,7 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.predator = function predator (amount, multiply) - { + ColorMatrixFilter.prototype.predator = function (amount, multiply) { var matrix = [ // row 1 11.224130630493164 * amount, @@ -44913,10 +42626,8 @@ var PIXI = (function (exports) { 0.8044459223747253 * amount, // row 4 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * LSD effect * @@ -44925,87 +42636,107 @@ var PIXI = (function (exports) { * @param {boolean} multiply - if true, current matrix and matrix are multiplied. If false, * just set the current matrix with @param matrix */ - ColorMatrixFilter.prototype.lsd = function lsd (multiply) - { + ColorMatrixFilter.prototype.lsd = function (multiply) { var matrix = [ 2, -0.4, 0.5, 0, 0, -0.5, 2, -0.4, 0, 0, -0.4, -0.5, 3, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, multiply); }; - /** * Erase the current matrix by setting the default one * */ - ColorMatrixFilter.prototype.reset = function reset () - { + ColorMatrixFilter.prototype.reset = function () { var matrix = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 ]; - this._loadMatrix(matrix, false); }; - - /** - * The matrix of the color matrix filter - * - * @member {number[]} - * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] - */ - prototypeAccessors.matrix.get = function () - { - return this.uniforms.m; - }; - - prototypeAccessors.matrix.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.m = value; - }; - - /** - * The opacity value to use when mixing the original and resultant colors. - * - * When the value is 0, the original color is used without modification. - * When the value is 1, the result color is used. - * When in the range (0, 1) the color is interpolated between the original and result by this amount. - * - * @member {number} - * @default 1 - */ - prototypeAccessors.alpha.get = function () - { - return this.uniforms.uAlpha; - }; - - prototypeAccessors.alpha.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.uAlpha = value; - }; - - Object.defineProperties( ColorMatrixFilter.prototype, prototypeAccessors ); - + Object.defineProperty(ColorMatrixFilter.prototype, "matrix", { + /** + * The matrix of the color matrix filter + * + * @member {number[]} + * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0] + */ + get: function () { + return this.uniforms.m; + }, + set: function (value) { + this.uniforms.m = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ColorMatrixFilter.prototype, "alpha", { + /** + * The opacity value to use when mixing the original and resultant colors. + * + * When the value is 0, the original color is used without modification. + * When the value is 1, the result color is used. + * When in the range (0, 1) the color is interpolated between the original and result by this amount. + * + * @member {number} + * @default 1 + */ + get: function () { + return this.uniforms.uAlpha; + }, + set: function (value) { + this.uniforms.uAlpha = value; + }, + enumerable: false, + configurable: true + }); return ColorMatrixFilter; }(Filter)); - // Americanized alias ColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale; /*! - * @pixi/filter-displacement - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-displacement - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-displacement is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var vertex$3 = "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"; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$f = function(d, b) { + extendStatics$f = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$f(d, b); + }; + + function __extends$f(d, b) { + extendStatics$f(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } - var fragment$5 = "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"; + var fragment$6 = "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"; + + var vertex$4 = "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"; /** * The DisplacementFilter class uses the pixel values from the specified texture @@ -45025,104 +42756,118 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var DisplacementFilter = /*@__PURE__*/(function (Filter) { - function DisplacementFilter(sprite, scale) - { + var DisplacementFilter = /** @class */ (function (_super) { + __extends$f(DisplacementFilter, _super); + /** + * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!) + * @param {number} [scale] - The scale of the displacement + */ + function DisplacementFilter(sprite, scale) { + var _this = this; var maskMatrix = new Matrix(); - sprite.renderable = false; - - Filter.call(this, vertex$3, fragment$5, { + _this = _super.call(this, vertex$4, fragment$6, { mapSampler: sprite._texture, filterMatrix: maskMatrix, scale: { x: 1, y: 1 }, rotation: new Float32Array([1, 0, 0, 1]), - }); - - this.maskSprite = sprite; - this.maskMatrix = maskMatrix; - - if (scale === null || scale === undefined) - { + }) || this; + _this.maskSprite = sprite; + _this.maskMatrix = maskMatrix; + if (scale === null || scale === undefined) { scale = 20; } - /** * scaleX, scaleY for displacements * @member {PIXI.Point} */ - this.scale = new Point(scale, scale); + _this.scale = new Point(scale, scale); + return _this; } - - if ( Filter ) { DisplacementFilter.__proto__ = Filter; } - DisplacementFilter.prototype = Object.create( Filter && Filter.prototype ); - DisplacementFilter.prototype.constructor = DisplacementFilter; - - var prototypeAccessors = { map: { configurable: true } }; - /** * Applies the filter. * * @param {PIXI.systems.FilterSystem} filterManager - The manager. * @param {PIXI.RenderTexture} input - The input target. * @param {PIXI.RenderTexture} output - The output target. - * @param {boolean} clear - Should the output be cleared before rendering to it. + * @param {PIXI.CLEAR_MODES} clearMode - clearMode. */ - DisplacementFilter.prototype.apply = function apply (filterManager, input, output, clear) - { + DisplacementFilter.prototype.apply = function (filterManager, input, output, clearMode) { // fill maskMatrix with _normalized sprite texture coords_ this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite); this.uniforms.scale.x = this.scale.x; this.uniforms.scale.y = this.scale.y; - // Extract rotation from world transform - var wt = this.maskSprite.transform.worldTransform; + var wt = this.maskSprite.worldTransform; var lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b)); var lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d)); - - if (lenX !== 0 && lenY !== 0) - { + if (lenX !== 0 && lenY !== 0) { this.uniforms.rotation[0] = wt.a / lenX; this.uniforms.rotation[1] = wt.b / lenX; this.uniforms.rotation[2] = wt.c / lenY; this.uniforms.rotation[3] = wt.d / lenY; } - // draw the filter... - filterManager.applyFilter(this, input, output, clear); + filterManager.applyFilter(this, input, output, clearMode); }; - - /** - * The texture used for the displacement map. Must be power of 2 sized texture. - * - * @member {PIXI.Texture} - */ - prototypeAccessors.map.get = function () - { - return this.uniforms.mapSampler; - }; - - prototypeAccessors.map.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.mapSampler = value; - }; - - Object.defineProperties( DisplacementFilter.prototype, prototypeAccessors ); - + Object.defineProperty(DisplacementFilter.prototype, "map", { + /** + * The texture used for the displacement map. Must be power of 2 sized texture. + * + * @member {PIXI.Texture} + */ + get: function () { + return this.uniforms.mapSampler; + }, + set: function (value) { + this.uniforms.mapSampler = value; + }, + enumerable: false, + configurable: true + }); return DisplacementFilter; }(Filter)); /*! - * @pixi/filter-fxaa - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-fxaa - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-fxaa is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var vertex$4 = "\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"; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$g = function(d, b) { + extendStatics$g = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$g(d, b); + }; + + function __extends$g(d, b) { + extendStatics$g(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } - var fragment$6 = "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"; + var vertex$5 = "\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"; + + var fragment$7 = "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"; /** * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com @@ -45135,35 +42880,58 @@ var PIXI = (function (exports) { * @memberof PIXI.filters * */ - var FXAAFilter = /*@__PURE__*/(function (Filter) { - function FXAAFilter() - { + var FXAAFilter = /** @class */ (function (_super) { + __extends$g(FXAAFilter, _super); + function FXAAFilter() { // TODO - needs work - Filter.call(this, vertex$4, fragment$6); + return _super.call(this, vertex$5, fragment$7) || this; } - - if ( Filter ) { FXAAFilter.__proto__ = Filter; } - FXAAFilter.prototype = Object.create( Filter && Filter.prototype ); - FXAAFilter.prototype.constructor = FXAAFilter; - return FXAAFilter; }(Filter)); /*! - * @pixi/filter-noise - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/filter-noise - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/filter-noise is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var fragment$7 = "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"; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$h = function(d, b) { + extendStatics$h = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$h(d, b); + }; + + function __extends$h(d, b) { + extendStatics$h(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var fragment$8 = "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"; /** * @author Vico @vicocotea * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js */ - /** * A Noise effect filter. * @@ -45171,100 +42939,91 @@ var PIXI = (function (exports) { * @extends PIXI.Filter * @memberof PIXI.filters */ - var NoiseFilter = /*@__PURE__*/(function (Filter) { - function NoiseFilter(noise, seed) - { - if ( noise === void 0 ) { noise = 0.5; } - if ( seed === void 0 ) { seed = Math.random(); } - - Filter.call(this, defaultFilter, fragment$7, { + var NoiseFilter = /** @class */ (function (_super) { + __extends$h(NoiseFilter, _super); + /** + * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1]. + * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`. + */ + function NoiseFilter(noise, seed) { + if (noise === void 0) { noise = 0.5; } + if (seed === void 0) { seed = Math.random(); } + var _this = _super.call(this, defaultFilter, fragment$8, { uNoise: 0, uSeed: 0, - }); - - this.noise = noise; - this.seed = seed; + }) || this; + _this.noise = noise; + _this.seed = seed; + return _this; } - - if ( Filter ) { NoiseFilter.__proto__ = Filter; } - NoiseFilter.prototype = Object.create( Filter && Filter.prototype ); - NoiseFilter.prototype.constructor = NoiseFilter; - - var prototypeAccessors = { noise: { configurable: true },seed: { configurable: true } }; - - /** - * The amount of noise to apply, this value should be in the range (0, 1]. - * - * @member {number} - * @default 0.5 - */ - prototypeAccessors.noise.get = function () - { - return this.uniforms.uNoise; - }; - - prototypeAccessors.noise.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.uNoise = value; - }; - - /** - * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. - * - * @member {number} - */ - prototypeAccessors.seed.get = function () - { - return this.uniforms.uSeed; - }; - - prototypeAccessors.seed.set = function (value) // eslint-disable-line require-jsdoc - { - this.uniforms.uSeed = value; - }; - - Object.defineProperties( NoiseFilter.prototype, prototypeAccessors ); - + Object.defineProperty(NoiseFilter.prototype, "noise", { + /** + * The amount of noise to apply, this value should be in the range (0, 1]. + * + * @member {number} + * @default 0.5 + */ + get: function () { + return this.uniforms.uNoise; + }, + set: function (value) { + this.uniforms.uNoise = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NoiseFilter.prototype, "seed", { + /** + * A seed value to apply to the random noise generation. `Math.random()` is a good value to use. + * + * @member {number} + */ + get: function () { + return this.uniforms.uSeed; + }, + set: function (value) { + this.uniforms.uSeed = value; + }, + enumerable: false, + configurable: true + }); return NoiseFilter; }(Filter)); /*! - * @pixi/mixin-cache-as-bitmap - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/mixin-cache-as-bitmap - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/mixin-cache-as-bitmap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ var _tempMatrix = new Matrix(); - DisplayObject.prototype._cacheAsBitmap = false; - DisplayObject.prototype._cacheData = false; - - // figured theres no point adding ALL the extra variables to prototype. + DisplayObject.prototype._cacheData = null; + // figured there's no point adding ALL the extra variables to prototype. // this model can hold the information needed. This can also be generated on demand as // most objects are not cached as bitmaps. /** * @class * @ignore */ - var CacheData = function CacheData() - { - 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; - }; - + var CacheData = /** @class */ (function () { + function CacheData() { + this.textureCacheId = null; + this.originalRender = null; + this.originalRenderCanvas = null; + this.originalCalculateBounds = null; + this.originalGetLocalBounds = null; + this.originalUpdateTransform = null; + this.originalDestroy = null; + this.originalMask = null; + this.originalFilterArea = null; + this.originalContainsPoint = null; + this.sprite = null; + } + return CacheData; + }()); Object.defineProperties(DisplayObject.prototype, { /** * Set this to true if you want this display object to be cached as a bitmap. @@ -45279,75 +43038,51 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# */ cacheAsBitmap: { - get: function get() - { + get: function () { return this._cacheAsBitmap; }, - set: function set(value) - { - if (this._cacheAsBitmap === value) - { + set: function (value) { + if (this._cacheAsBitmap === value) { return; } - this._cacheAsBitmap = value; - var data; - - if (value) - { - if (!this._cacheData) - { + if (value) { + if (!this._cacheData) { this._cacheData = new CacheData(); } - data = this._cacheData; - data.originalRender = this.render; data.originalRenderCanvas = this.renderCanvas; - data.originalUpdateTransform = this.updateTransform; data.originalCalculateBounds = this.calculateBounds; data.originalGetLocalBounds = this.getLocalBounds; - data.originalDestroy = this.destroy; - data.originalContainsPoint = this.containsPoint; - data.originalMask = this._mask; data.originalFilterArea = this.filterArea; - this.render = this._renderCached; this.renderCanvas = this._renderCachedCanvas; - this.destroy = this._cacheAsBitmapDestroy; } - else - { + else { data = this._cacheData; - - if (data.sprite) - { + if (data.sprite) { this._destroyCachedDisplayObject(); } - this.render = data.originalRender; this.renderCanvas = data.originalRenderCanvas; this.calculateBounds = data.originalCalculateBounds; this.getLocalBounds = data.originalGetLocalBounds; - this.destroy = data.originalDestroy; - this.updateTransform = data.originalUpdateTransform; this.containsPoint = data.originalContainsPoint; - this._mask = data.originalMask; this.filterArea = data.originalFilterArea; } }, }, }); - /** * Renders a cached version of the sprite with WebGL * @@ -45356,20 +43091,15 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ - DisplayObject.prototype._renderCached = function _renderCached(renderer) - { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) - { + DisplayObject.prototype._renderCached = function _renderCached(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { return; } - this._initCachedDisplayObject(renderer); - this._cacheData.sprite.transform._worldID = this.transform._worldID; this._cacheData.sprite.worldAlpha = this.worldAlpha; this._cacheData.sprite._render(renderer); }; - /** * Prepares the WebGL renderer to cache the sprite * @@ -45378,135 +43108,93 @@ var PIXI = (function (exports) { * @memberof PIXI.DisplayObject# * @param {PIXI.Renderer} renderer - the WebGL renderer */ - DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) - { - if (this._cacheData && this._cacheData.sprite) - { + DisplayObject.prototype._initCachedDisplayObject = function _initCachedDisplayObject(renderer) { + if (this._cacheData && this._cacheData.sprite) { return; } - // make sure alpha is set to 1 otherwise it will get rendered as invisible! var cacheAlpha = this.alpha; - this.alpha = 1; - // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) renderer.batch.flush(); // this.filters= []; - // next we find the dimensions of the untransformed object // this function also calls updatetransform on all its children as part of the measuring. // This means we don't need to update the transform again in this function // TODO pass an object to clone too? saves having to create a new one each time! - var bounds = this.getLocalBounds().clone(); - + var bounds = this.getLocalBounds(null, true).clone(); // add some padding! - if (this.filters) - { + if (this.filters) { var padding = this.filters[0].padding; - bounds.pad(padding); } - bounds.ceil(settings.RESOLUTION); - // for now we cache the current renderTarget that the WebGL renderer is currently using. // this could be more elegant.. var cachedRenderTexture = renderer.renderTexture.current; - var cachedSourceFrame = renderer.renderTexture.sourceFrame; + var cachedSourceFrame = renderer.renderTexture.sourceFrame.clone(); var cachedProjectionTransform = renderer.projection.transform; - // We also store the filter stack - I will definitely look to change how this works a little later down the line. // const stack = renderer.filterManager.filterStack; - // this renderTexture will be used to store the cached DisplayObject - var renderTexture = RenderTexture.create(bounds.width, bounds.height); - - var textureCacheId = "cacheAsBitmap_" + (uid()); - + var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); + var textureCacheId = "cacheAsBitmap_" + uid(); this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); Texture.addToCache(renderTexture, textureCacheId); - // need to set // - var m = _tempMatrix; - - m.tx = -bounds.x; - m.ty = -bounds.y; - - // reset - this.transform.worldTransform.identity(); - + var m = this.transform.localTransform.copyTo(_tempMatrix).invert().translate(-bounds.x, -bounds.y); // set all properties to there original so we can render to a texture this.render = this._cacheData.originalRender; - - renderer.render(this, renderTexture, true, m, true); - + renderer.render(this, renderTexture, true, m, false); // now restore the state be setting the new properties renderer.projection.transform = cachedProjectionTransform; renderer.renderTexture.bind(cachedRenderTexture, cachedSourceFrame); - // renderer.filterManager.filterStack = stack; - this.render = this._renderCached; // the rest is the same as for Canvas this.updateTransform = this.displayObjectUpdateTransform; this.calculateBounds = this._calculateCachedBounds; this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; this.filterArea = null; - // create our cached sprite var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; cachedSprite.anchor.x = -(bounds.x / bounds.width); cachedSprite.anchor.y = -(bounds.y / bounds.height); cachedSprite.alpha = cacheAlpha; cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) - { - this.parent = renderer._tempDisplayObjectParent; + if (!this.parent) { + this.enableTempParent(); this.updateTransform(); - this.parent = null; + this.disableTempParent(null); } - else - { + else { this.updateTransform(); } - // map the hit test.. this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); }; - /** * Renders a cached version of the sprite with canvas * * @private * @function _renderCachedCanvas * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer */ - DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) - { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) - { + DisplayObject.prototype._renderCachedCanvas = function _renderCachedCanvas(renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { return; } - this._initCachedDisplayObjectCanvas(renderer); - this._cacheData.sprite.worldAlpha = this.worldAlpha; this._cacheData.sprite._renderCanvas(renderer); }; - // TODO this can be the same as the WebGL version.. will need to do a little tweaking first though.. /** * Prepares the Canvas renderer to cache the sprite @@ -45514,131 +43202,97 @@ var PIXI = (function (exports) { * @private * @function _initCachedDisplayObjectCanvas * @memberof PIXI.DisplayObject# - * @param {PIXI.Renderer} renderer - the WebGL renderer + * @param {PIXI.CanvasRenderer} renderer - The canvas renderer */ - DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) - { - if (this._cacheData && this._cacheData.sprite) - { + DisplayObject.prototype._initCachedDisplayObjectCanvas = function _initCachedDisplayObjectCanvas(renderer) { + if (this._cacheData && this._cacheData.sprite) { return; } - // get bounds actually transforms the object for us already! - var bounds = this.getLocalBounds(); - + var bounds = this.getLocalBounds(null, true); var cacheAlpha = this.alpha; - this.alpha = 1; - var cachedRenderTarget = renderer.context; - + var cachedProjectionTransform = renderer._projTransform; bounds.ceil(settings.RESOLUTION); - - var renderTexture = RenderTexture.create(bounds.width, bounds.height); - - var textureCacheId = "cacheAsBitmap_" + (uid()); - + var renderTexture = RenderTexture.create({ width: bounds.width, height: bounds.height }); + var textureCacheId = "cacheAsBitmap_" + uid(); this._cacheData.textureCacheId = textureCacheId; - BaseTexture.addToCache(renderTexture.baseTexture, textureCacheId); Texture.addToCache(renderTexture, textureCacheId); - // need to set // var m = _tempMatrix; - this.transform.localTransform.copyTo(m); m.invert(); - m.tx -= bounds.x; m.ty -= bounds.y; - // m.append(this.transform.worldTransform.) // set all properties to there original so we can render to a texture this.renderCanvas = this._cacheData.originalRenderCanvas; - - // renderTexture.render(this, m, true); renderer.render(this, renderTexture, true, m, false); - // now restore the state be setting the new properties renderer.context = cachedRenderTarget; - + renderer._projTransform = cachedProjectionTransform; this.renderCanvas = this._renderCachedCanvas; // the rest is the same as for WebGL this.updateTransform = this.displayObjectUpdateTransform; this.calculateBounds = this._calculateCachedBounds; this.getLocalBounds = this._getCachedLocalBounds; - this._mask = null; this.filterArea = null; - // create our cached sprite var cachedSprite = new Sprite(renderTexture); - cachedSprite.transform.worldTransform = this.transform.worldTransform; cachedSprite.anchor.x = -(bounds.x / bounds.width); cachedSprite.anchor.y = -(bounds.y / bounds.height); cachedSprite.alpha = cacheAlpha; cachedSprite._bounds = this._bounds; - this._cacheData.sprite = cachedSprite; - this.transform._parentID = -1; // restore the transform of the cached sprite to avoid the nasty flicker.. - if (!this.parent) - { + if (!this.parent) { this.parent = renderer._tempDisplayObjectParent; this.updateTransform(); this.parent = null; } - else - { + else { this.updateTransform(); } - // map the hit test.. this.containsPoint = cachedSprite.containsPoint.bind(cachedSprite); }; - /** * Calculates the bounds of the cached sprite * * @private */ - DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() - { + DisplayObject.prototype._calculateCachedBounds = function _calculateCachedBounds() { this._bounds.clear(); this._cacheData.sprite.transform._worldID = this.transform._worldID; this._cacheData.sprite._calculateBounds(); - this._lastBoundsID = this._boundsID; + this._bounds.updateID = this._boundsID; }; - /** * Gets the bounds of the cached sprite. * * @private * @return {Rectangle} The local bounds. */ - DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() - { - return this._cacheData.sprite.getLocalBounds(); + DisplayObject.prototype._getCachedLocalBounds = function _getCachedLocalBounds() { + return this._cacheData.sprite.getLocalBounds(null); }; - /** * Destroys the cached sprite. * * @private */ - DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() - { + DisplayObject.prototype._destroyCachedDisplayObject = function _destroyCachedDisplayObject() { this._cacheData.sprite._texture.destroy(true); this._cacheData.sprite = null; - BaseTexture.removeFromCache(this._cacheData.textureCacheId); Texture.removeFromCache(this._cacheData.textureCacheId); - this._cacheData.textureCacheId = null; }; - /** * Destroys the cached object. * @@ -45647,15 +43301,14 @@ var PIXI = (function (exports) { * have been set to that value. * Used when destroying containers, see the Container.destroy method. */ - DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) - { + DisplayObject.prototype._cacheAsBitmapDestroy = function _cacheAsBitmapDestroy(options) { this.cacheAsBitmap = false; this.destroy(options); }; /*! - * @pixi/mixin-get-child-by-name - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/mixin-get-child-by-name - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/mixin-get-child-by-name is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45668,31 +43321,41 @@ var PIXI = (function (exports) { * @member {string} name */ DisplayObject.prototype.name = null; - /** * Returns the display object in the container. * + * Recursive searches are done in a preorder traversal. + * * @method getChildByName * @memberof PIXI.Container# * @param {string} name - Instance name. + * @param {boolean}[deep=false] - Whether to search recursively * @return {PIXI.DisplayObject} The child with the specified name. */ - Container.prototype.getChildByName = function getChildByName(name) - { - for (var i = 0; i < this.children.length; i++) - { - if (this.children[i].name === name) - { + Container.prototype.getChildByName = function getChildByName(name, deep) { + for (var i = 0, j = this.children.length; i < j; i++) { + if (this.children[i].name === name) { return this.children[i]; } } - + if (deep) { + for (var i = 0, j = this.children.length; i < j; i++) { + var child = this.children[i]; + if (!child.getChildByName) { + continue; + } + var target = this.children[i].getChildByName(name, true); + if (target) { + return target; + } + } + } return null; }; /*! - * @pixi/mixin-get-global-position - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/mixin-get-global-position - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/mixin-get-global-position is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -45709,26 +43372,211 @@ var PIXI = (function (exports) { * nice performance boost. * @return {PIXI.Point} The updated point. */ - DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) - { - if ( point === void 0 ) { point = new Point(); } - if ( skipUpdate === void 0 ) { skipUpdate = false; } - - if (this.parent) - { + DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) { + if (point === void 0) { point = new Point(); } + if (skipUpdate === void 0) { skipUpdate = false; } + if (this.parent) { this.parent.toGlobal(this.position, point, skipUpdate); } - else - { + else { point.x = this.position.x; point.y = this.position.y; } - return point; }; - var v5 = '5.0.0'; + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$i = function(d, b) { + extendStatics$i = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$i(d, b); + }; + + function __extends$i(d, b) { + extendStatics$i(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var __assign = function() { + __assign = Object.assign || function __assign(t) { + var arguments$1 = arguments; + + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments$1[i]; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } } + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __rest(s, e) { + var t = {}; + for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + { t[p] = s[p]; } } + if (s != null && typeof Object.getOwnPropertySymbols === "function") + { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0) + { t[p[i]] = s[p[i]]; } } } + return t; + } + + function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); } + else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } } + return c > 3 && r && Object.defineProperty(target, key, r), r; + } + + function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + } + + function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(metadataKey, metadataValue); } + } + + function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) { throw t[1]; } return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) { throw new TypeError("Generator is already executing."); } + while (_) { try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) { return t; } + if (y = 0, t) { op = [op[0] & 2, t.value]; } + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) { _.ops.pop(); } + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } } + if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true }; + } + } + + function __exportStar(m, exports) { + for (var p in m) { if (!exports.hasOwnProperty(p)) { exports[p] = m[p]; } } + } + + function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) { return m.call(o); } + return { + next: function () { + if (o && i >= o.length) { o = void 0; } + return { value: o && o[i++], done: !o }; + } + }; + } + + function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) { return o; } + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) { m.call(i); } + } + finally { if (e) { throw e.error; } } + } + return ar; + } + + function __spread() { + var arguments$1 = arguments; + + for (var ar = [], i = 0; i < arguments.length; i++) + { ar = ar.concat(__read(arguments$1[i])); } + return ar; + } + + function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + } + + function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) { resume(q[0][0], q[0][1]); } } + } + + function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } + } + + function __asyncValues(o) { + if (!Symbol.asyncIterator) { throw new TypeError("Symbol.asyncIterator is not defined."); } + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + } + + function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + function __importStar(mod) { + if (mod && mod.__esModule) { return mod; } + var result = {}; + if (mod != null) { for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) { result[k] = mod[k]; } } } + result.default = mod; + return result; + } + + function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; + } + var v5 = '5.0.0'; /** * Deprecations (backward compatibilities) are automatically applied for browser bundles * in the UMD module format. If using Webpack or Rollup, you'll need to apply these @@ -45739,10 +43587,10 @@ var PIXI = (function (exports) { * @memberof PIXI * @function useDeprecated */ - function useDeprecated() - { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + function useDeprecated() { + // eslint-disable-next-line @typescript-eslint/no-this-alias var PIXI = this; - Object.defineProperties(PIXI, { /** * @constant {RegExp|string} SVG_SIZE @@ -45751,42 +43599,33 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ SVG_SIZE: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.utils.SVG_SIZE property has moved to PIXI.resources.SVGResource.SVG_SIZE'); - return PIXI.SVGResource.SVG_SIZE; }, }, - /** * @class PIXI.TransformStatic * @deprecated since 5.0.0 * @see PIXI.Transform */ TransformStatic: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.TransformStatic class has been removed, use PIXI.Transform'); - return PIXI.Transform; }, }, - /** * @class PIXI.TransformBase * @deprecated since 5.0.0 * @see PIXI.Transform */ TransformBase: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.TransformBase class has been removed, use PIXI.Transform'); - return PIXI.Transform; }, }, - /** * Constants that specify the transform type. * @@ -45800,42 +43639,33 @@ var PIXI = (function (exports) { * @property {number} DYNAMIC */ TRANSFORM_MODE: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.TRANSFORM_MODE property has been removed'); - return { STATIC: 0, DYNAMIC: 1 }; }, }, - /** * @class PIXI.WebGLRenderer * @see PIXI.Renderer * @deprecated since 5.0.0 */ WebGLRenderer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.WebGLRenderer class has moved to PIXI.Renderer'); - return PIXI.Renderer; }, }, - /** * @class PIXI.CanvasRenderTarget * @see PIXI.utils.CanvasRenderTarget * @deprecated since 5.0.0 */ CanvasRenderTarget: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.CanvasRenderTarget class has moved to PIXI.utils.CanvasRenderTarget'); - return PIXI.utils.CanvasRenderTarget; }, }, - /** * @memberof PIXI * @name loader @@ -45844,64 +43674,111 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ loader: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loader instance has moved to PIXI.Loader.shared'); - return PIXI.Loader.shared; }, }, - /** * @class PIXI.FilterManager * @see PIXI.systems.FilterSystem * @deprecated since 5.0.0 */ FilterManager: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.FilterManager class has moved to PIXI.systems.FilterSystem'); - return PIXI.systems.FilterSystem; }, }, - /** * @namespace PIXI.CanvasTinter * @see PIXI.canvasUtils * @deprecated since 5.2.0 */ CanvasTinter: { - get: function get() - { + get: function () { deprecation('5.2.0', 'PIXI.CanvasTinter namespace has moved to PIXI.canvasUtils'); - return PIXI.canvasUtils; }, }, - /** * @namespace PIXI.GroupD8 * @see PIXI.groupD8 * @deprecated since 5.2.0 */ GroupD8: { - get: function get() - { + get: function () { deprecation('5.2.0', 'PIXI.GroupD8 namespace has moved to PIXI.groupD8'); - return PIXI.groupD8; }, }, }); - + /** + * @namespace PIXI.accessibility + * @see PIXI + * @deprecated since 5.3.0 + */ + PIXI.accessibility = {}; + Object.defineProperties(PIXI.accessibility, { + /** + * @class PIXI.accessibility.AccessibilityManager + * @deprecated since 5.3.0 + * @see PIXI.AccessibilityManager + */ + AccessibilityManager: { + get: function () { + deprecation('5.3.0', 'PIXI.accessibility.AccessibilityManager moved to PIXI.AccessibilityManager'); + return PIXI.AccessibilityManager; + }, + }, + }); + /** + * @namespace PIXI.interaction + * @see PIXI + * @deprecated since 5.3.0 + */ + PIXI.interaction = {}; + Object.defineProperties(PIXI.interaction, { + /** + * @class PIXI.interaction.InteractionManager + * @deprecated since 5.3.0 + * @see PIXI.InteractionManager + */ + InteractionManager: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionManager moved to PIXI.InteractionManager'); + return PIXI.InteractionManager; + }, + }, + /** + * @class PIXI.interaction.InteractionData + * @deprecated since 5.3.0 + * @see PIXI.InteractionData + */ + InteractionData: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionData moved to PIXI.InteractionData'); + return PIXI.InteractionData; + }, + }, + /** + * @class PIXI.interaction.InteractionEvent + * @deprecated since 5.3.0 + * @see PIXI.InteractionEvent + */ + InteractionEvent: { + get: function () { + deprecation('5.3.0', 'PIXI.interaction.InteractionEvent moved to PIXI.InteractionEvent'); + return PIXI.InteractionEvent; + }, + }, + }); /** * @namespace PIXI.prepare * @see PIXI * @deprecated since 5.2.1 */ PIXI.prepare = {}; - Object.defineProperties(PIXI.prepare, { /** * @class PIXI.prepare.BasePrepare @@ -45909,10 +43786,8 @@ var PIXI = (function (exports) { * @see PIXI.BasePrepare */ BasePrepare: { - get: function get() - { + get: function () { deprecation('5.2.1', 'PIXI.prepare.BasePrepare moved to PIXI.BasePrepare'); - return PIXI.BasePrepare; }, }, @@ -45922,10 +43797,8 @@ var PIXI = (function (exports) { * @see PIXI.Prepare */ Prepare: { - get: function get() - { + get: function () { deprecation('5.2.1', 'PIXI.prepare.Prepare moved to PIXI.Prepare'); - return PIXI.Prepare; }, }, @@ -45935,22 +43808,18 @@ var PIXI = (function (exports) { * @see PIXI.CanvasPrepare */ CanvasPrepare: { - get: function get() - { + get: function () { deprecation('5.2.1', 'PIXI.prepare.CanvasPrepare moved to PIXI.CanvasPrepare'); - return PIXI.CanvasPrepare; }, }, }); - /** * @namespace PIXI.extract * @see PIXI * @deprecated since 5.2.1 */ PIXI.extract = {}; - Object.defineProperties(PIXI.extract, { /** * @class PIXI.extract.Extract @@ -45958,10 +43827,8 @@ var PIXI = (function (exports) { * @see PIXI.Extract */ Extract: { - get: function get() - { + get: function () { deprecation('5.2.1', 'PIXI.extract.Extract moved to PIXI.Extract'); - return PIXI.Extract; }, }, @@ -45971,15 +43838,12 @@ var PIXI = (function (exports) { * @see PIXI.CanvasExtract */ CanvasExtract: { - get: function get() - { + get: function () { deprecation('5.2.1', 'PIXI.extract.CanvasExtract moved to PIXI.CanvasExtract'); - return PIXI.CanvasExtract; }, }, }); - /** * This namespace has been removed. All classes previous nested * under this namespace have been moved to the top-level `PIXI` object. @@ -45987,7 +43851,6 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ PIXI.extras = {}; - Object.defineProperties(PIXI.extras, { /** * @class PIXI.extras.TilingSprite @@ -45995,10 +43858,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ TilingSprite: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.extras.TilingSprite class has moved to PIXI.TilingSprite'); - return PIXI.TilingSprite; }, }, @@ -46008,10 +43869,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ TilingSpriteRenderer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.extras.TilingSpriteRenderer class has moved to PIXI.TilingSpriteRenderer'); - return PIXI.TilingSpriteRenderer; }, }, @@ -46021,10 +43880,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ AnimatedSprite: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.extras.AnimatedSprite class has moved to PIXI.AnimatedSprite'); - return PIXI.AnimatedSprite; }, }, @@ -46034,15 +43891,46 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ BitmapText: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.extras.BitmapText class has moved to PIXI.BitmapText'); - return PIXI.BitmapText; }, }, }); - + /** + * @static + * @method PIXI.TilingSprite.fromFrame + * @deprecated since 5.3.0 + * @see PIXI.TilingSprite.from + */ + PIXI.TilingSprite.fromFrame = function fromFrame(frameId, width, height) { + deprecation('5.3.0', 'TilingSprite.fromFrame is deprecated, use TilingSprite.from'); + return PIXI.TilingSprite.from(frameId, { width: width, height: height }); + }; + /** + * @static + * @method PIXI.TilingSprite.fromImage + * @deprecated since 5.3.0 + * @see PIXI.TilingSprite.from + */ + PIXI.TilingSprite.fromImage = function fromImage(imageId, width, height, options) { + if (options === void 0) { options = {}; } + deprecation('5.3.0', 'TilingSprite.fromImage is deprecated, use TilingSprite.from'); + // Fallback support for crossorigin, scaleMode parameters + if (options && typeof options !== 'object') { + options = { + // eslint-disable-next-line prefer-rest-params + scaleMode: arguments[4], + resourceOptions: { + // eslint-disable-next-line prefer-rest-params + crossorigin: arguments[3], + }, + }; + } + options.width = width; + options.height = height; + return PIXI.TilingSprite.from(imageId, options); + }; Object.defineProperties(PIXI.utils, { /** * @function PIXI.utils.getSvgSize @@ -46050,22 +43938,18 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ getSvgSize: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.utils.getSvgSize function has moved to PIXI.resources.SVGResource.getSize'); - - return PIXI.SVGResource.getSize; + return PIXI.resources.SVGResource.getSize; }, }, }); - /** * All classes on this namespace have moved to the high-level `PIXI` object. * @namespace PIXI.mesh * @deprecated since 5.0.0 */ PIXI.mesh = {}; - Object.defineProperties(PIXI.mesh, { /** * @class PIXI.mesh.Mesh @@ -46073,10 +43957,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ Mesh: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.Mesh class has moved to PIXI.SimpleMesh'); - return PIXI.SimpleMesh; }, }, @@ -46086,10 +43968,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ NineSlicePlane: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.NineSlicePlane class has moved to PIXI.NineSlicePlane'); - return PIXI.NineSlicePlane; }, }, @@ -46099,10 +43979,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ Plane: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.Plane class has moved to PIXI.SimplePlane'); - return PIXI.SimplePlane; }, }, @@ -46112,10 +43990,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ Rope: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.Rope class has moved to PIXI.SimpleRope'); - return PIXI.SimpleRope; }, }, @@ -46125,10 +44001,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ RawMesh: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.RawMesh class has moved to PIXI.Mesh'); - return PIXI.Mesh; }, }, @@ -46138,10 +44012,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ CanvasMeshRenderer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.CanvasMeshRenderer class has moved to PIXI.CanvasMeshRenderer'); - return PIXI.CanvasMeshRenderer; }, }, @@ -46151,15 +44023,12 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ MeshRenderer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.mesh.MeshRenderer class has moved to PIXI.MeshRenderer'); - return PIXI.MeshRenderer; }, }, }); - /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. @@ -46167,7 +44036,6 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ PIXI.particles = {}; - Object.defineProperties(PIXI.particles, { /** * @class PIXI.particles.ParticleContainer @@ -46175,10 +44043,8 @@ var PIXI = (function (exports) { * @see PIXI.ParticleContainer */ ParticleContainer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.particles.ParticleContainer class has moved to PIXI.ParticleContainer'); - return PIXI.ParticleContainer; }, }, @@ -46188,15 +44054,12 @@ var PIXI = (function (exports) { * @see PIXI.ParticleRenderer */ ParticleRenderer: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.particles.ParticleRenderer class has moved to PIXI.ParticleRenderer'); - return PIXI.ParticleRenderer; }, }, }); - /** * This namespace has been removed and items have been moved to * the top-level `PIXI` object. @@ -46204,7 +44067,6 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ PIXI.ticker = {}; - Object.defineProperties(PIXI.ticker, { /** * @class PIXI.ticker.Ticker @@ -46212,10 +44074,8 @@ var PIXI = (function (exports) { * @see PIXI.Ticker */ Ticker: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.ticker.Ticker class has moved to PIXI.Ticker'); - return PIXI.Ticker; }, }, @@ -46226,22 +44086,18 @@ var PIXI = (function (exports) { * @see PIXI.Ticker.shared */ shared: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.ticker.shared instance has moved to PIXI.Ticker.shared'); - return PIXI.Ticker.shared; }, }, }); - /** * All classes on this namespace have moved to the high-level `PIXI` object. * @namespace PIXI.loaders * @deprecated since 5.0.0 */ PIXI.loaders = {}; - Object.defineProperties(PIXI.loaders, { /** * @class PIXI.loaders.Loader @@ -46249,10 +44105,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ Loader: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loaders.Loader class has moved to PIXI.Loader'); - return PIXI.Loader; }, }, @@ -46262,10 +44116,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ Resource: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loaders.Resource class has moved to PIXI.LoaderResource'); - return PIXI.LoaderResource; }, }, @@ -46275,24 +44127,18 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ bitmapFontParser: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loaders.bitmapFontParser function has moved to PIXI.BitmapFontLoader.use'); - return PIXI.BitmapFontLoader.use; }, }, /** * @function PIXI.loaders.parseBitmapFontData - * @see PIXI.BitmapFontLoader.parse * @deprecated since 5.0.0 */ parseBitmapFontData: { - get: function get() - { - deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has moved to PIXI.BitmapFontLoader.parse'); - - return PIXI.BitmapFontLoader.parse; + get: function () { + deprecation(v5, 'PIXI.loaders.parseBitmapFontData function has removed'); }, }, /** @@ -46301,10 +44147,8 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ spritesheetParser: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loaders.spritesheetParser function has moved to PIXI.SpritesheetLoader.use'); - return PIXI.SpritesheetLoader.use; }, }, @@ -46314,58 +44158,77 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 */ getResourcePath: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.loaders.getResourcePath property has moved to PIXI.SpritesheetLoader.getResourcePath'); - return PIXI.SpritesheetLoader.getResourcePath; }, }, }); - /** * @function PIXI.loaders.Loader.addPixiMiddleware * @see PIXI.Loader.registerPlugin * @deprecated since 5.0.0 * @param {function} middleware */ - PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) - { - deprecation(v5, - 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin' - ); - + PIXI.Loader.addPixiMiddleware = function addPixiMiddleware(middleware) { + deprecation(v5, 'PIXI.loaders.Loader.addPixiMiddleware function is deprecated, use PIXI.loaders.Loader.registerPlugin'); return PIXI.loaders.Loader.registerPlugin({ use: middleware() }); }; - + // convenience for converting event name to signal name + var eventToSignal = function (event) { + return "on" + event.charAt(0).toUpperCase() + event.slice(1); + }; + Object.assign(PIXI.Loader.prototype, { + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#on + * @deprecated since 5.0.0 + */ + on: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#on is completely deprecated, use PIXI.Loader#" + signal + ".add"); + }, + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#once + * @deprecated since 5.0.0 + */ + once: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#once is completely deprecated, use PIXI.Loader#" + signal + ".once"); + }, + /** + * Use the corresponding signal, e.g., event `start`` is signal `onStart`. + * @method PIXI.Loader#off + * @deprecated since 5.0.0 + */ + off: function (event) { + var signal = eventToSignal(event); + deprecation(v5, "PIXI.Loader#off is completely deprecated, use PIXI.Loader#" + signal + ".detach"); + }, + }); /** * @class PIXI.extract.WebGLExtract * @deprecated since 5.0.0 * @see PIXI.Extract */ Object.defineProperty(PIXI.extract, 'WebGLExtract', { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.extract.WebGLExtract method has moved to PIXI.Extract'); - return PIXI.Extract; }, }); - /** * @class PIXI.prepare.WebGLPrepare * @deprecated since 5.0.0 * @see PIXI.Prepare */ Object.defineProperty(PIXI.prepare, 'WebGLPrepare', { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.prepare.WebGLPrepare class has moved to PIXI.Prepare'); - return PIXI.Prepare; }, }); - /** * @method PIXI.Container#_renderWebGL * @private @@ -46373,52 +44236,40 @@ var PIXI = (function (exports) { * @see PIXI.Container#render * @param {PIXI.Renderer} renderer Instance of renderer */ - PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) - { + PIXI.Container.prototype._renderWebGL = function _renderWebGL(renderer) { deprecation(v5, 'PIXI.Container._renderWebGL method has moved to PIXI.Container._render'); - this._render(renderer); }; - /** * @method PIXI.Container#renderWebGL * @deprecated since 5.0.0 * @see PIXI.Container#render * @param {PIXI.Renderer} renderer Instance of renderer */ - PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) - { + PIXI.Container.prototype.renderWebGL = function renderWebGL(renderer) { deprecation(v5, 'PIXI.Container.renderWebGL method has moved to PIXI.Container.render'); - this.render(renderer); }; - /** * @method PIXI.DisplayObject#renderWebGL * @deprecated since 5.0.0 * @see PIXI.DisplayObject#render * @param {PIXI.Renderer} renderer Instance of renderer */ - PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) - { + PIXI.DisplayObject.prototype.renderWebGL = function renderWebGL(renderer) { deprecation(v5, 'PIXI.DisplayObject.renderWebGL method has moved to PIXI.DisplayObject.render'); - this.render(renderer); }; - /** * @method PIXI.Container#renderAdvancedWebGL * @deprecated since 5.0.0 * @see PIXI.Container#renderAdvanced * @param {PIXI.Renderer} renderer Instance of renderer */ - PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) - { + PIXI.Container.prototype.renderAdvancedWebGL = function renderAdvancedWebGL(renderer) { deprecation(v5, 'PIXI.Container.renderAdvancedWebGL method has moved to PIXI.Container.renderAdvanced'); - this.renderAdvanced(renderer); }; - Object.defineProperties(PIXI.settings, { /** * Default transform type. @@ -46430,41 +44281,30 @@ var PIXI = (function (exports) { * @default PIXI.TRANSFORM_MODE.STATIC */ TRANSFORM_MODE: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); - return 0; }, - set: function set() - { + set: function () { deprecation(v5, 'PIXI.settings.TRANSFORM_MODE property has been removed'); }, }, }); - - var BaseTexture = PIXI.BaseTexture; - + var BaseTextureAny = PIXI.BaseTexture; /** * @method loadSource * @memberof PIXI.BaseTexture# * @deprecated since 5.0.0 */ - BaseTexture.prototype.loadSource = function loadSource(image) - { + BaseTextureAny.prototype.loadSource = function loadSource(image) { deprecation(v5, 'PIXI.BaseTexture.loadSource method has been deprecated'); - var resource = PIXI.resources.autoDetectResource(image); - resource.internal = true; - this.setResource(resource); this.update(); }; - var baseTextureIdDeprecation = false; - - Object.defineProperties(BaseTexture.prototype, { + Object.defineProperties(BaseTextureAny.prototype, { /** * @name PIXI.BaseTexture#hasLoaded * @type {boolean} @@ -46473,10 +44313,8 @@ var PIXI = (function (exports) { * @see PIXI.BaseTexture#valid */ hasLoaded: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.BaseTexture.hasLoaded property has been removed, use PIXI.BaseTexture.valid'); - return this.valid; }, }, @@ -46484,22 +44322,17 @@ var PIXI = (function (exports) { * @name PIXI.BaseTexture#imageUrl * @type {string} * @deprecated since 5.0.0 - * @see PIXI.resource.ImageResource#url + * @see PIXI.resources.ImageResource#url */ imageUrl: { - get: function get() - { + get: function () { + var _a; deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - - return this.resource && this.resource.url; + return (_a = this.resource) === null || _a === void 0 ? void 0 : _a.url; }, - - set: function set(imageUrl) - { + set: function (imageUrl) { deprecation(v5, 'PIXI.BaseTexture.imageUrl property has been removed, use PIXI.BaseTexture.resource.url'); - - if (this.resource) - { + if (this.resource) { this.resource.url = imageUrl; } }, @@ -46512,24 +44345,18 @@ var PIXI = (function (exports) { * @see PIXI.resources.BaseImageResource#source */ source: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source`'); - - return this.resource && this.resource.source; + return this.resource.source; }, - set: function set(source) - { + set: function (source) { deprecation(v5, 'PIXI.BaseTexture.source property has been moved, use `PIXI.BaseTexture.resource.source` ' + 'if you want to set HTMLCanvasElement. Otherwise, create new BaseTexture.'); - - if (this.resource) - { + if (this.resource) { this.resource.source = source; } }, }, - /** * @name PIXI.BaseTexture#premultiplyAlpha * @type {boolean} @@ -46538,18 +44365,14 @@ var PIXI = (function (exports) { * @see PIXI.BaseTexture#alphaMode */ premultiplyAlpha: { - get: function get() - { + get: function () { deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' + ', see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; }, - set: function set(value) - { + set: function (value) { deprecation('5.2.0', 'PIXI.BaseTexture.premultiplyAlpha property has been changed to `alphaMode`' + ', see `PIXI.ALPHA_MODES`'); - this.alphaMode = Number(value); }, }, @@ -46562,24 +44385,19 @@ var PIXI = (function (exports) { * @see PIXI.BaseTexture#_batchLocation */ _id: { - get: function get() - { - if (!baseTextureIdDeprecation) - { + get: function () { + if (!baseTextureIdDeprecation) { // #popelyshev: That property was a hot place, I don't want to call deprecation method on it if possible deprecation('5.2.0', 'PIXI.BaseTexture._id batch local field has been changed to `_batchLocation`'); baseTextureIdDeprecation = true; } - return this._batchLocation; }, - set: function set(value) - { + set: function (value) { this._batchLocation = value; }, }, }); - /** * @method fromImage * @static @@ -46587,15 +44405,11 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 * @see PIXI.BaseTexture.from */ - BaseTexture.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) - { + BaseTextureAny.fromImage = function fromImage(canvas, crossorigin, scaleMode, scale) { deprecation(v5, 'PIXI.BaseTexture.fromImage method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - - return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); + return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); }; - /** * @method fromCanvas * @static @@ -46603,13 +44417,10 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 * @see PIXI.BaseTexture.from */ - BaseTexture.fromCanvas = function fromCanvas(canvas, scaleMode) - { + BaseTextureAny.fromCanvas = function fromCanvas(canvas, scaleMode) { deprecation(v5, 'PIXI.BaseTexture.fromCanvas method has been replaced with PIXI.BaseTexture.from'); - - return BaseTexture.from(canvas, { scaleMode: scaleMode }); + return BaseTextureAny.from(canvas, { scaleMode: scaleMode }); }; - /** * @method fromSVG * @static @@ -46617,15 +44428,11 @@ var PIXI = (function (exports) { * @deprecated since 5.0.0 * @see PIXI.BaseTexture.from */ - BaseTexture.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) - { + BaseTextureAny.fromSVG = function fromSVG(canvas, crossorigin, scaleMode, scale) { deprecation(v5, 'PIXI.BaseTexture.fromSVG method has been replaced with PIXI.BaseTexture.from'); - var resourceOptions = { scale: scale, crossorigin: crossorigin }; - - return BaseTexture.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); + return BaseTextureAny.from(canvas, { scaleMode: scaleMode, resourceOptions: resourceOptions }); }; - Object.defineProperties(PIXI.resources.ImageResource.prototype, { /** * @name PIXI.resources.ImageResource#premultiplyAlpha @@ -46635,161 +44442,116 @@ var PIXI = (function (exports) { * @see PIXI.resources.ImageResource#alphaMode */ premultiplyAlpha: { - get: function get() - { + get: function () { deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); - return this.alphaMode !== 0; }, - set: function set(value) - { + set: function (value) { deprecation('5.2.0', 'PIXI.resources.ImageResource.premultiplyAlpha property ' + 'has been changed to `alphaMode`, see `PIXI.ALPHA_MODES`'); this.alphaMode = Number(value); }, }, }); - /** * @method PIXI.Point#copy * @deprecated since 5.0.0 * @see PIXI.Point#copyFrom */ - PIXI.Point.prototype.copy = function copy(p) - { + PIXI.Point.prototype.copy = function copy(p) { deprecation(v5, 'PIXI.Point.copy method has been replaced with PIXI.Point.copyFrom'); - return this.copyFrom(p); }; - /** * @method PIXI.ObservablePoint#copy * @deprecated since 5.0.0 * @see PIXI.ObservablePoint#copyFrom */ - PIXI.ObservablePoint.prototype.copy = function copy(p) - { + PIXI.ObservablePoint.prototype.copy = function copy(p) { deprecation(v5, 'PIXI.ObservablePoint.copy method has been replaced with PIXI.ObservablePoint.copyFrom'); - return this.copyFrom(p); }; - /** * @method PIXI.Rectangle#copy * @deprecated since 5.0.0 * @see PIXI.Rectangle#copyFrom */ - PIXI.Rectangle.prototype.copy = function copy(p) - { + PIXI.Rectangle.prototype.copy = function copy(p) { deprecation(v5, 'PIXI.Rectangle.copy method has been replaced with PIXI.Rectangle.copyFrom'); - return this.copyFrom(p); }; - /** * @method PIXI.Matrix#copy * @deprecated since 5.0.0 * @see PIXI.Matrix#copyTo */ - PIXI.Matrix.prototype.copy = function copy(p) - { + PIXI.Matrix.prototype.copy = function copy(p) { deprecation(v5, 'PIXI.Matrix.copy method has been replaced with PIXI.Matrix.copyTo'); - return this.copyTo(p); }; - /** * @method PIXI.systems.StateSystem#setState * @deprecated since 5.1.0 * @see PIXI.systems.StateSystem#set */ - PIXI.systems.StateSystem.prototype.setState = function setState(s) - { + PIXI.systems.StateSystem.prototype.setState = function setState(s) { deprecation('v5.1.0', 'StateSystem.setState has been renamed to StateSystem.set'); - return this.set(s); }; - Object.assign(PIXI.systems.FilterSystem.prototype, { /** * @method PIXI.FilterManager#getRenderTarget * @deprecated since 5.0.0 * @see PIXI.systems.FilterSystem#getFilterTexture */ - getRenderTarget: function getRenderTarget(clear, resolution) - { - deprecation(v5, - 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture' - ); - - return this.getFilterTexture(resolution); + getRenderTarget: function (_clear, resolution) { + deprecation(v5, 'PIXI.FilterManager.getRenderTarget method has been replaced with PIXI.systems.FilterSystem#getFilterTexture'); + return this.getFilterTexture(null, resolution); }, - /** * @method PIXI.FilterManager#returnRenderTarget * @deprecated since 5.0.0 * @see PIXI.systems.FilterSystem#returnFilterTexture */ - returnRenderTarget: function returnRenderTarget(renderTexture) - { - deprecation(v5, - 'PIXI.FilterManager.returnRenderTarget method has been replaced with ' - + 'PIXI.systems.FilterSystem.returnFilterTexture' - ); - + returnRenderTarget: function (renderTexture) { + deprecation(v5, 'PIXI.FilterManager.returnRenderTarget method has been replaced with ' + + 'PIXI.systems.FilterSystem.returnFilterTexture'); this.returnFilterTexture(renderTexture); }, - /** * @method PIXI.systems.FilterSystem#calculateScreenSpaceMatrix * @deprecated since 5.0.0 * @param {PIXI.Matrix} outputMatrix - the matrix to output to. * @return {PIXI.Matrix} The mapped matrix. */ - calculateScreenSpaceMatrix: function calculateScreenSpaceMatrix(outputMatrix) - { + calculateScreenSpaceMatrix: function (outputMatrix) { deprecation(v5, 'PIXI.systems.FilterSystem.calculateScreenSpaceMatrix method is removed, ' + 'use `(vTextureCoord * inputSize.xy) + outputFrame.xy` instead'); - var mappedMatrix = outputMatrix.identity(); - var ref = this.activeState; - var sourceFrame = ref.sourceFrame; - var destinationFrame = ref.destinationFrame; - + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); mappedMatrix.scale(destinationFrame.width, destinationFrame.height); - return mappedMatrix; }, - /** * @method PIXI.systems.FilterSystem#calculateNormalizedScreenSpaceMatrix * @deprecated since 5.0.0 * @param {PIXI.Matrix} outputMatrix - The matrix to output to. * @return {PIXI.Matrix} The mapped matrix. */ - calculateNormalizedScreenSpaceMatrix: function calculateNormalizedScreenSpaceMatrix(outputMatrix) - { + calculateNormalizedScreenSpaceMatrix: function (outputMatrix) { deprecation(v5, 'PIXI.systems.FilterManager.calculateNormalizedScreenSpaceMatrix method is removed, ' + 'use `((vTextureCoord * inputSize.xy) + outputFrame.xy) / outputFrame.zw` instead.'); - - var ref = this.activeState; - var sourceFrame = ref.sourceFrame; - var destinationFrame = ref.destinationFrame; + var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame; var mappedMatrix = outputMatrix.identity(); - mappedMatrix.translate(sourceFrame.x / destinationFrame.width, sourceFrame.y / destinationFrame.height); - var translateScaleX = (destinationFrame.width / sourceFrame.width); var translateScaleY = (destinationFrame.height / sourceFrame.height); - mappedMatrix.scale(translateScaleX, translateScaleY); - return mappedMatrix; }, }); - Object.defineProperties(PIXI.RenderTexture.prototype, { /** * @name PIXI.RenderTexture#sourceFrame @@ -46798,10 +44560,8 @@ var PIXI = (function (exports) { * @readonly */ sourceFrame: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.RenderTexture.sourceFrame property has been removed'); - return this.filterFrame; }, }, @@ -46812,255 +44572,186 @@ var PIXI = (function (exports) { * @readonly */ size: { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.RenderTexture.size property has been removed'); - return this._frame; }, }, }); - /** * @class BlurXFilter * @memberof PIXI.filters * @deprecated since 5.0.0 * @see PIXI.filters.BlurFilterPass */ - var BlurXFilter = /*@__PURE__*/(function (superclass) { - function BlurXFilter(strength, quality, resolution, kernelSize) - { + var BlurXFilter = /** @class */ (function (_super) { + __extends$i(BlurXFilter, _super); + function BlurXFilter(strength, quality, resolution, kernelSize) { + var _this = this; deprecation(v5, 'PIXI.filters.BlurXFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - - superclass.call(this, true, strength, quality, resolution, kernelSize); + _this = _super.call(this, true, strength, quality, resolution, kernelSize) || this; + return _this; } - - if ( superclass ) BlurXFilter.__proto__ = superclass; - BlurXFilter.prototype = Object.create( superclass && superclass.prototype ); - BlurXFilter.prototype.constructor = BlurXFilter; - return BlurXFilter; }(PIXI.filters.BlurFilterPass)); - /** * @class BlurYFilter * @memberof PIXI.filters * @deprecated since 5.0.0 * @see PIXI.filters.BlurFilterPass */ - var BlurYFilter = /*@__PURE__*/(function (superclass) { - function BlurYFilter(strength, quality, resolution, kernelSize) - { + var BlurYFilter = /** @class */ (function (_super) { + __extends$i(BlurYFilter, _super); + function BlurYFilter(strength, quality, resolution, kernelSize) { + var _this = this; deprecation(v5, 'PIXI.filters.BlurYFilter class is deprecated, use PIXI.filters.BlurFilterPass'); - - superclass.call(this, false, strength, quality, resolution, kernelSize); + _this = _super.call(this, false, strength, quality, resolution, kernelSize) || this; + return _this; } - - if ( superclass ) BlurYFilter.__proto__ = superclass; - BlurYFilter.prototype = Object.create( superclass && superclass.prototype ); - BlurYFilter.prototype.constructor = BlurYFilter; - return BlurYFilter; }(PIXI.filters.BlurFilterPass)); - Object.assign(PIXI.filters, { BlurXFilter: BlurXFilter, BlurYFilter: BlurYFilter, }); - - var Sprite = PIXI.Sprite; - var Texture = PIXI.Texture; - var Graphics = PIXI.Graphics; - + var SpriteAny = PIXI.Sprite, TextureAny = PIXI.Texture, GraphicsAny = PIXI.Graphics; // Support for pixi.js-legacy bifurcation // give users a friendly assist to use legacy - if (!Graphics.prototype.generateCanvasTexture) - { - Graphics.prototype.generateCanvasTexture = function generateCanvasTexture() - { + if (!GraphicsAny.prototype.generateCanvasTexture) { + GraphicsAny.prototype.generateCanvasTexture = function generateCanvasTexture() { deprecation(v5, 'PIXI.Graphics.generateCanvasTexture method is only available in "pixi.js-legacy"'); }; } - /** * @deprecated since 5.0.0 * @member {PIXI.Graphics} PIXI.Graphics#graphicsData * @see PIXI.Graphics#geometry * @readonly */ - Object.defineProperty(PIXI.Graphics.prototype, 'graphicsData', { - get: function get() - { + Object.defineProperty(GraphicsAny.prototype, 'graphicsData', { + get: function () { deprecation(v5, 'PIXI.Graphics.graphicsData property is deprecated, use PIXI.Graphics.geometry.graphicsData'); - return this.geometry.graphicsData; }, }); - - /** - * @deprecated since 5.0.0 - * @member {PIXI.Point[]} PIXI.SimpleRope#points - * @see PIXI.Mesh#geometry - */ - Object.defineProperty(PIXI.SimpleRope.prototype, 'points', { - get: function get() - { - deprecation(v5, 'PIXI.SimpleRope.points property is deprecated, ' - + 'use PIXI.SimpleRope.geometry.points'); - - return this.geometry.points; - }, - set: function set(value) - { - deprecation(v5, 'PIXI.SimpleRope.points property is deprecated, ' - + 'use PIXI.SimpleRope.geometry.points'); - - this.geometry.points = value; - }, - }); - // Use these to deprecate all the Sprite from* methods - function spriteFrom(name, source, crossorigin, scaleMode) - { - deprecation(v5, ("PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from")); - - return Sprite.from(source, { + function spriteFrom(name, source, crossorigin, scaleMode) { + deprecation(v5, "PIXI.Sprite." + name + " method is deprecated, use PIXI.Sprite.from"); + return SpriteAny.from(source, { resourceOptions: { scale: scaleMode, crossorigin: crossorigin, }, }); } - /** * @deprecated since 5.0.0 * @see PIXI.Sprite.from * @method PIXI.Sprite.fromImage * @return {PIXI.Sprite} */ - Sprite.fromImage = spriteFrom.bind(null, 'fromImage'); - + SpriteAny.fromImage = spriteFrom.bind(null, 'fromImage'); /** * @deprecated since 5.0.0 * @method PIXI.Sprite.fromSVG * @see PIXI.Sprite.from * @return {PIXI.Sprite} */ - Sprite.fromSVG = spriteFrom.bind(null, 'fromSVG'); - + SpriteAny.fromSVG = spriteFrom.bind(null, 'fromSVG'); /** * @deprecated since 5.0.0 * @method PIXI.Sprite.fromCanvas * @see PIXI.Sprite.from * @return {PIXI.Sprite} */ - Sprite.fromCanvas = spriteFrom.bind(null, 'fromCanvas'); - + SpriteAny.fromCanvas = spriteFrom.bind(null, 'fromCanvas'); /** * @deprecated since 5.0.0 * @method PIXI.Sprite.fromVideo * @see PIXI.Sprite.from * @return {PIXI.Sprite} */ - Sprite.fromVideo = spriteFrom.bind(null, 'fromVideo'); - + SpriteAny.fromVideo = spriteFrom.bind(null, 'fromVideo'); /** * @deprecated since 5.0.0 * @method PIXI.Sprite.fromFrame * @see PIXI.Sprite.from * @return {PIXI.Sprite} */ - Sprite.fromFrame = spriteFrom.bind(null, 'fromFrame'); - + SpriteAny.fromFrame = spriteFrom.bind(null, 'fromFrame'); // Use these to deprecate all the Texture from* methods - function textureFrom(name, source, crossorigin, scaleMode) - { - deprecation(v5, ("PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from")); - - return Texture.from(source, { + function textureFrom(name, source, crossorigin, scaleMode) { + deprecation(v5, "PIXI.Texture." + name + " method is deprecated, use PIXI.Texture.from"); + return TextureAny.from(source, { resourceOptions: { scale: scaleMode, crossorigin: crossorigin, }, }); } - /** * @deprecated since 5.0.0 * @method PIXI.Texture.fromImage * @see PIXI.Texture.from * @return {PIXI.Texture} */ - Texture.fromImage = textureFrom.bind(null, 'fromImage'); - + TextureAny.fromImage = textureFrom.bind(null, 'fromImage'); /** * @deprecated since 5.0.0 * @method PIXI.Texture.fromSVG * @see PIXI.Texture.from * @return {PIXI.Texture} */ - Texture.fromSVG = textureFrom.bind(null, 'fromSVG'); - + TextureAny.fromSVG = textureFrom.bind(null, 'fromSVG'); /** * @deprecated since 5.0.0 * @method PIXI.Texture.fromCanvas * @see PIXI.Texture.from * @return {PIXI.Texture} */ - Texture.fromCanvas = textureFrom.bind(null, 'fromCanvas'); - + TextureAny.fromCanvas = textureFrom.bind(null, 'fromCanvas'); /** * @deprecated since 5.0.0 * @method PIXI.Texture.fromVideo * @see PIXI.Texture.from * @return {PIXI.Texture} */ - Texture.fromVideo = textureFrom.bind(null, 'fromVideo'); - + TextureAny.fromVideo = textureFrom.bind(null, 'fromVideo'); /** * @deprecated since 5.0.0 * @method PIXI.Texture.fromFrame * @see PIXI.Texture.from * @return {PIXI.Texture} */ - Texture.fromFrame = textureFrom.bind(null, 'fromFrame'); - + TextureAny.fromFrame = textureFrom.bind(null, 'fromFrame'); /** * @deprecated since 5.0.0 * @member {boolean} PIXI.AbstractRenderer#autoResize * @see PIXI.AbstractRenderer#autoDensity */ Object.defineProperty(PIXI.AbstractRenderer.prototype, 'autoResize', { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' + 'use PIXI.AbstractRenderer.autoDensity'); - return this.autoDensity; }, - set: function set(value) - { + set: function (value) { deprecation(v5, 'PIXI.AbstractRenderer.autoResize property is deprecated, ' + 'use PIXI.AbstractRenderer.autoDensity'); - this.autoDensity = value; }, }); - /** * @deprecated since 5.0.0 * @member {PIXI.systems.TextureSystem} PIXI.Renderer#textureManager * @see PIXI.Renderer#texture */ Object.defineProperty(PIXI.Renderer.prototype, 'textureManager', { - get: function get() - { + get: function () { deprecation(v5, 'PIXI.Renderer.textureManager property is deprecated, use PIXI.Renderer.texture'); - return this.texture; }, }); - /** * @namespace PIXI.utils.mixins * @deprecated since 5.0.0 @@ -47071,8 +44762,7 @@ var PIXI = (function (exports) { * @function mixin * @deprecated since 5.0.0 */ - mixin: function mixin() - { + mixin: function () { deprecation(v5, 'PIXI.utils.mixins.mixin function is no longer available'); }, /** @@ -47080,8 +44770,7 @@ var PIXI = (function (exports) { * @function delayMixin * @deprecated since 5.0.0 */ - delayMixin: function delayMixin() - { + delayMixin: function () { deprecation(v5, 'PIXI.utils.mixins.delayMixin function is no longer available'); }, /** @@ -47089,876 +44778,131 @@ var PIXI = (function (exports) { * @function performMixins * @deprecated since 5.0.0 */ - performMixins: function performMixins() - { + performMixins: function () { deprecation(v5, 'PIXI.utils.mixins.performMixins function is no longer available'); }, }; + /** + * @memberof PIXI.BitmapText + * @member {object} font + * @deprecated since 5.3.0 + */ + Object.defineProperty(PIXI.BitmapText.prototype, 'font', { + get: function () { + deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' + + 'use fontName, fontSize, tint or align properties'); + return { + name: this._fontName, + size: this._fontSize, + tint: this._tint, + align: this._align, + }; + }, + set: function (value) { + deprecation('5.3.0', 'PIXI.BitmapText.font property is deprecated, ' + + 'use fontName, fontSize, tint or align properties'); + if (!value) { + return; + } + var style = { font: value }; + this._upgradeStyle(style); + style.fontSize = style.fontSize || PIXI.BitmapFont.available[style.fontName].size; + this._fontName = style.fontName; + this._fontSize = style.fontSize; + this.dirty = true; + }, + }); } /*! - * @pixi/mesh - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC - * - * @pixi/mesh is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ - - /** - * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space. - * - * @class - * @memberof PIXI - */ - var MeshBatchUvs = function MeshBatchUvs(uvBuffer, uvMatrix) - { - /** - * Buffer with normalized UV's - * @member {PIXI.Buffer} - */ - this.uvBuffer = uvBuffer; - - /** - * Material UV matrix - * @member {PIXI.TextureMatrix} - */ - this.uvMatrix = uvMatrix; - - /** - * UV Buffer data - * @member {Float32Array} - * @readonly - */ - this.data = null; - - this._bufferUpdateId = -1; - - this._textureUpdateId = -1; - - this._updateID = 0; - }; - - /** - * updates - * - * @param {boolean} forceUpdate - force the update - */ - MeshBatchUvs.prototype.update = function update (forceUpdate) - { - if (!forceUpdate - && this._bufferUpdateId === this.uvBuffer._updateID - && this._textureUpdateId === this.uvMatrix._updateID) - { - return; - } - - this._bufferUpdateId = this.uvBuffer._updateID; - this._textureUpdateId = this.uvMatrix._updateID; - - var data = this.uvBuffer.data; - - if (!this.data || this.data.length !== data.length) - { - this.data = new Float32Array(data.length); - } - - this.uvMatrix.multiplyUvs(data, this.data); - - this._updateID++; - }; - - var tempPoint$2 = new Point(); - var tempPolygon = new Polygon(); - - /** - * Base mesh class. - * - * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of. - * This class assumes a certain level of WebGL knowledge. - * If you know a bit this should abstract enough away to make you life easier! - * - * Pretty much ALL WebGL can be broken down into the following: - * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc.. - * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry) - * - State - This is the state of WebGL required to render the mesh. - * - * Through a combination of the above elements you can render anything you want, 2D or 3D! - * - * @class - * @extends PIXI.Container - * @memberof PIXI - */ - var Mesh = /*@__PURE__*/(function (Container) { - function Mesh(geometry, shader, state, drawMode)// vertices, uvs, indices, drawMode) - { - if ( drawMode === void 0 ) { drawMode = exports.DRAW_MODES.TRIANGLES; } - - Container.call(this); - - /** - * Includes vertex positions, face indices, normals, colors, UVs, and - * custom attributes within buffers, reducing the cost of passing all - * this data to the GPU. Can be shared between multiple Mesh objects. - * @member {PIXI.Geometry} - * @readonly - */ - this.geometry = geometry; - - geometry.refCount++; - - /** - * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU. - * Can be shared between multiple Mesh objects. - * @member {PIXI.Shader|PIXI.MeshMaterial} - */ - this.shader = shader; - - /** - * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g., - * blend mode, culling, depth testing, direction of rendering triangles, backface, etc. - * @member {PIXI.State} - */ - this.state = state || State.for2d(); - - /** - * The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. - * - * @member {number} - * @see PIXI.DRAW_MODES - */ - this.drawMode = drawMode; - - /** - * Typically the index of the IndexBuffer where to start drawing. - * @member {number} - * @default 0 - */ - this.start = 0; - - /** - * How much of the geometry to draw, by default `0` renders everything. - * @member {number} - * @default 0 - */ - this.size = 0; - - /** - * thease are used as easy access for batching - * @member {Float32Array} - * @private - */ - this.uvs = null; - - /** - * thease are used as easy access for batching - * @member {Uint16Array} - * @private - */ - this.indices = null; - - /** - * this is the caching layer used by the batcher - * @member {Float32Array} - * @private - */ - this.vertexData = new Float32Array(1); - - /** - * If geometry is changed used to decide to re-transform - * the vertexData. - * @member {number} - * @private - */ - this.vertexDirty = 0; - - this._transformID = -1; - - // Inherited from DisplayMode, set defaults - this.tint = 0xFFFFFF; - this.blendMode = exports.BLEND_MODES.NORMAL; - - /** - * Internal roundPixels field - * - * @member {boolean} - * @private - */ - this._roundPixels = settings.ROUND_PIXELS; - - /** - * Batched UV's are cached for atlas textures - * @member {PIXI.MeshBatchUvs} - * @private - */ - this.batchUvs = null; - } - - if ( Container ) { Mesh.__proto__ = Container; } - Mesh.prototype = Object.create( Container && Container.prototype ); - Mesh.prototype.constructor = Mesh; - - var prototypeAccessors = { uvBuffer: { configurable: true },verticesBuffer: { configurable: true },material: { configurable: true },blendMode: { configurable: true },roundPixels: { configurable: true },tint: { configurable: true },texture: { configurable: true } }; - - /** - * To change mesh uv's, change its uvBuffer data and increment its _updateID. - * @member {PIXI.Buffer} - * @readonly - */ - prototypeAccessors.uvBuffer.get = function () - { - return this.geometry.buffers[1]; - }; - - /** - * To change mesh vertices, change its uvBuffer data and increment its _updateID. - * Incrementing _updateID is optional because most of Mesh objects do it anyway. - * @member {PIXI.Buffer} - * @readonly - */ - prototypeAccessors.verticesBuffer.get = function () - { - return this.geometry.buffers[0]; - }; - - /** - * Alias for {@link PIXI.Mesh#shader}. - * @member {PIXI.Shader|PIXI.MeshMaterial} - */ - prototypeAccessors.material.set = function (value) - { - this.shader = value; - }; - - prototypeAccessors.material.get = function () - { - return this.shader; - }; - - /** - * The blend mode to be applied to the Mesh. Apply a value of - * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. - * - * @member {number} - * @default PIXI.BLEND_MODES.NORMAL; - * @see PIXI.BLEND_MODES - */ - prototypeAccessors.blendMode.set = function (value) - { - this.state.blendMode = value; - }; - - prototypeAccessors.blendMode.get = function () - { - return this.state.blendMode; - }; - - /** - * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. - * Advantages can include sharper image quality (like text) and faster rendering on canvas. - * The main disadvantage is movement of objects may appear less smooth. - * To set the global default, change {@link PIXI.settings.ROUND_PIXELS} - * - * @member {boolean} - * @default false - */ - prototypeAccessors.roundPixels.set = function (value) - { - if (this._roundPixels !== value) - { - this._transformID = -1; - } - this._roundPixels = value; - }; - - prototypeAccessors.roundPixels.get = function () - { - return this._roundPixels; - }; - - /** - * The multiply tint applied to the Mesh. This is a hex value. A value of - * `0xFFFFFF` will remove any tint effect. - * - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.get = function () - { - return this.shader.tint; - }; - - prototypeAccessors.tint.set = function (value) - { - this.shader.tint = value; - }; - - /** - * The texture that the Mesh uses. - * - * @member {PIXI.Texture} - */ - prototypeAccessors.texture.get = function () - { - return this.shader.texture; - }; - - prototypeAccessors.texture.set = function (value) - { - this.shader.texture = value; - }; - - /** - * Standard renderer draw. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._render = function _render (renderer) - { - // set properties for batching.. - // TODO could use a different way to grab verts? - var vertices = this.geometry.buffers[0].data; - - // TODO benchmark check for attribute size.. - if (this.shader.batchable && this.drawMode === exports.DRAW_MODES.TRIANGLES && vertices.length < Mesh.BATCHABLE_SIZE * 2) - { - this._renderToBatch(renderer); - } - else - { - this._renderDefault(renderer); - } - }; - - /** - * Standard non-batching way of rendering. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderDefault = function _renderDefault (renderer) - { - var shader = this.shader; - - shader.alpha = this.worldAlpha; - if (shader.update) - { - shader.update(); - } - - renderer.batch.flush(); - - if (shader.program.uniformData.translationMatrix) - { - shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true); - } - - // bind and sync uniforms.. - renderer.shader.bind(shader); - - // set state.. - renderer.state.set(this.state); - - // bind the geometry... - renderer.geometry.bind(this.geometry, shader); - - // then render it - renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount); - }; - - /** - * Rendering by using the Batch system. - * @protected - * @param {PIXI.Renderer} renderer - Instance to renderer. - */ - Mesh.prototype._renderToBatch = function _renderToBatch (renderer) - { - var geometry = this.geometry; - - if (this.shader.uvMatrix) - { - this.shader.uvMatrix.update(); - this.calculateUvs(); - } - - // set properties for batching.. - this.calculateVertices(); - this.indices = geometry.indexBuffer.data; - this._tintRGB = this.shader._tintRGB; - this._texture = this.shader.texture; - - var pluginName = this.material.pluginName; - - renderer.batch.setObjectRenderer(renderer.plugins[pluginName]); - renderer.plugins[pluginName].render(this); - }; - - /** - * Updates vertexData field based on transform and vertices - */ - Mesh.prototype.calculateVertices = function calculateVertices () - { - var geometry = this.geometry; - var vertices = geometry.buffers[0].data; - - if (geometry.vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID) - { - return; - } - - this._transformID = this.transform._worldID; - - if (this.vertexData.length !== vertices.length) - { - this.vertexData = new Float32Array(vertices.length); - } - - var wt = this.transform.worldTransform; - var a = wt.a; - var b = wt.b; - var c = wt.c; - var d = wt.d; - var tx = wt.tx; - var ty = wt.ty; - - var vertexData = this.vertexData; - - for (var i = 0; i < vertexData.length / 2; i++) - { - var x = vertices[(i * 2)]; - var y = vertices[(i * 2) + 1]; - - vertexData[(i * 2)] = (a * x) + (c * y) + tx; - vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty; - } - - if (this._roundPixels) - { - var resolution = settings.RESOLUTION; - - for (var i$1 = 0; i$1 < vertexData.length; ++i$1) - { - vertexData[i$1] = Math.round((vertexData[i$1] * resolution | 0) / resolution); - } - } - - this.vertexDirty = geometry.vertexDirtyId; - }; - - /** - * Updates uv field based on from geometry uv's or batchUvs - */ - Mesh.prototype.calculateUvs = function calculateUvs () - { - var geomUvs = this.geometry.buffers[1]; - - if (!this.shader.uvMatrix.isSimple) - { - if (!this.batchUvs) - { - this.batchUvs = new MeshBatchUvs(geomUvs, this.shader.uvMatrix); - } - this.batchUvs.update(); - this.uvs = this.batchUvs.data; - } - else - { - this.uvs = geomUvs.data; - } - }; - - /** - * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account. - * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly. - * - * @protected - */ - Mesh.prototype._calculateBounds = function _calculateBounds () - { - this.calculateVertices(); - - this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length); - }; - - /** - * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES. - * - * @param {PIXI.Point} point the point to test - * @return {boolean} the result of the test - */ - Mesh.prototype.containsPoint = function containsPoint (point) - { - if (!this.getBounds().contains(point.x, point.y)) - { - return false; - } - - this.worldTransform.applyInverse(point, tempPoint$2); - - var vertices = this.geometry.getBuffer('aVertexPosition').data; - - var points = tempPolygon.points; - var indices = this.geometry.getIndex().data; - var len = indices.length; - var step = this.drawMode === 4 ? 3 : 1; - - for (var i = 0; i + 2 < len; i += step) - { - var ind0 = indices[i] * 2; - var ind1 = indices[i + 1] * 2; - var ind2 = indices[i + 2] * 2; - - points[0] = vertices[ind0]; - points[1] = vertices[ind0 + 1]; - points[2] = vertices[ind1]; - points[3] = vertices[ind1 + 1]; - points[4] = vertices[ind2]; - points[5] = vertices[ind2 + 1]; - - if (tempPolygon.contains(tempPoint$2.x, tempPoint$2.y)) - { - return true; - } - } - - return false; - }; - /** - * Destroys the Mesh object. - * - * @param {object|boolean} [options] - Options parameter. A boolean will act as if all - * options have been set to that value - * @param {boolean} [options.children=false] - if set to true, all the children will have - * their destroy method called as well. 'options' will be passed on to those calls. - */ - Mesh.prototype.destroy = function destroy (options) - { - Container.prototype.destroy.call(this, options); - - this.geometry.refCount--; - if (this.geometry.refCount === 0) - { - this.geometry.dispose(); - } - - this.geometry = null; - this.shader = null; - this.state = null; - this.uvs = null; - this.indices = null; - this.vertexData = null; - }; - - Object.defineProperties( Mesh.prototype, prototypeAccessors ); - - return Mesh; - }(Container)); - - /** - * The maximum number of vertices to consider batchable. Generally, the complexity - * of the geometry. - * @memberof PIXI.Mesh - * @static - * @member {number} BATCHABLE_SIZE - */ - Mesh.BATCHABLE_SIZE = 100; - - var vertex$5 = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n"; - - var fragment$8 = "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"; - - /** - * Slightly opinionated default shader for PixiJS 2D objects. - * @class - * @memberof PIXI - * @extends PIXI.Shader - */ - var MeshMaterial = /*@__PURE__*/(function (Shader) { - function MeshMaterial(uSampler, options) - { - var uniforms = { - uSampler: uSampler, - alpha: 1, - uTextureMatrix: Matrix.IDENTITY, - uColor: new Float32Array([1, 1, 1, 1]), - }; - - // Set defaults - options = Object.assign({ - tint: 0xFFFFFF, - alpha: 1, - pluginName: 'batch', - }, options); - - if (options.uniforms) - { - Object.assign(uniforms, options.uniforms); - } - - Shader.call(this, options.program || Program.from(vertex$5, fragment$8), uniforms); - - /** - * Only do update if tint or alpha changes. - * @member {boolean} - * @private - * @default false - */ - this._colorDirty = false; - - /** - * TextureMatrix instance for this Mesh, used to track Texture changes - * - * @member {PIXI.TextureMatrix} - * @readonly - */ - this.uvMatrix = new TextureMatrix(uSampler); - - /** - * `true` if shader can be batch with the renderer's batch system. - * @member {boolean} - * @default true - */ - this.batchable = options.program === undefined; - - /** - * Renderer plugin for batching - * - * @member {string} - * @default 'batch' - */ - this.pluginName = options.pluginName; - - this.tint = options.tint; - this.alpha = options.alpha; - } - - if ( Shader ) { MeshMaterial.__proto__ = Shader; } - MeshMaterial.prototype = Object.create( Shader && Shader.prototype ); - MeshMaterial.prototype.constructor = MeshMaterial; - - var prototypeAccessors = { texture: { configurable: true },alpha: { configurable: true },tint: { configurable: true } }; - - /** - * Reference to the texture being rendered. - * @member {PIXI.Texture} - */ - prototypeAccessors.texture.get = function () - { - return this.uniforms.uSampler; - }; - prototypeAccessors.texture.set = function (value) - { - if (this.uniforms.uSampler !== value) - { - this.uniforms.uSampler = value; - this.uvMatrix.texture = value; - } - }; - - /** - * This gets automatically set by the object using this. - * - * @default 1 - * @member {number} - */ - prototypeAccessors.alpha.set = function (value) - { - if (value === this._alpha) { return; } - - this._alpha = value; - this._colorDirty = true; - }; - prototypeAccessors.alpha.get = function () - { - return this._alpha; - }; - - /** - * Multiply tint for the material. - * @member {number} - * @default 0xFFFFFF - */ - prototypeAccessors.tint.set = function (value) - { - if (value === this._tint) { return; } - - this._tint = value; - this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16); - this._colorDirty = true; - }; - prototypeAccessors.tint.get = function () - { - return this._tint; - }; - - /** - * Gets called automatically by the Mesh. Intended to be overridden for custom - * MeshMaterial objects. - */ - MeshMaterial.prototype.update = function update () - { - if (this._colorDirty) - { - this._colorDirty = false; - var baseTexture = this.texture.baseTexture; - - premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, baseTexture.alphaMode); - } - if (this.uvMatrix.update()) - { - this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord; - } - }; - - Object.defineProperties( MeshMaterial.prototype, prototypeAccessors ); - - return MeshMaterial; - }(Shader)); - - /** - * Standard 2D geometry used in PixiJS. - * - * Geometry can be defined without passing in a style or data if required. - * - * ```js - * const geometry = new PIXI.Geometry(); - * - * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2); - * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1], 2); - * geometry.addIndex([0,1,2,1,3,2]); - * - * ``` - * @class - * @memberof PIXI - * @extends PIXI.Geometry - */ - var MeshGeometry = /*@__PURE__*/(function (Geometry) { - function MeshGeometry(vertices, uvs, index) - { - Geometry.call(this); - - var verticesBuffer = new Buffer(vertices); - var uvsBuffer = new Buffer(uvs, true); - var indexBuffer = new Buffer(index, true, true); - - this.addAttribute('aVertexPosition', verticesBuffer, 2, false, exports.TYPES.FLOAT) - .addAttribute('aTextureCoord', uvsBuffer, 2, false, exports.TYPES.FLOAT) - .addIndex(indexBuffer); - - /** - * Dirty flag to limit update calls on Mesh. For example, - * limiting updates on a single Mesh instance with a shared Geometry - * within the render loop. - * @private - * @member {number} - * @default -1 - */ - this._updateId = -1; - } - - if ( Geometry ) { MeshGeometry.__proto__ = Geometry; } - MeshGeometry.prototype = Object.create( Geometry && Geometry.prototype ); - MeshGeometry.prototype.constructor = MeshGeometry; - - var prototypeAccessors = { vertexDirtyId: { configurable: true } }; - - /** - * If the vertex position is updated. - * @member {number} - * @readonly - * @private - */ - prototypeAccessors.vertexDirtyId.get = function () - { - return this.buffers[0]._updateID; - }; - - Object.defineProperties( MeshGeometry.prototype, prototypeAccessors ); - - return MeshGeometry; - }(Geometry)); - - /*! - * @pixi/mesh-extras - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/mesh-extras - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/mesh-extras is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ - var PlaneGeometry = /*@__PURE__*/(function (MeshGeometry) { - function PlaneGeometry(width, height, segWidth, segHeight) - { - if ( width === void 0 ) { width = 100; } - if ( height === void 0 ) { height = 100; } - if ( segWidth === void 0 ) { segWidth = 10; } - if ( segHeight === void 0 ) { segHeight = 10; } + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$j = function(d, b) { + extendStatics$j = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$j(d, b); + }; + + function __extends$j(d, b) { + extendStatics$j(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } - MeshGeometry.call(this); - - this.segWidth = segWidth; - this.segHeight = segHeight; - - this.width = width; - this.height = height; - - this.build(); + var PlaneGeometry = /** @class */ (function (_super) { + __extends$j(PlaneGeometry, _super); + function PlaneGeometry(width, height, segWidth, segHeight) { + if (width === void 0) { width = 100; } + if (height === void 0) { height = 100; } + if (segWidth === void 0) { segWidth = 10; } + if (segHeight === void 0) { segHeight = 10; } + var _this = _super.call(this) || this; + _this.segWidth = segWidth; + _this.segHeight = segHeight; + _this.width = width; + _this.height = height; + _this.build(); + return _this; } - - if ( MeshGeometry ) { PlaneGeometry.__proto__ = MeshGeometry; } - PlaneGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype ); - PlaneGeometry.prototype.constructor = PlaneGeometry; - /** * Refreshes plane coordinates * @private */ - PlaneGeometry.prototype.build = function build () - { + PlaneGeometry.prototype.build = function () { var total = this.segWidth * this.segHeight; var verts = []; var uvs = []; var indices = []; - var segmentsX = this.segWidth - 1; var segmentsY = this.segHeight - 1; - var sizeX = (this.width) / segmentsX; var sizeY = (this.height) / segmentsY; - - for (var i = 0; i < total; i++) - { + for (var i = 0; i < total; i++) { var x = (i % this.segWidth); var y = ((i / this.segWidth) | 0); - verts.push(x * sizeX, y * sizeY); uvs.push(x / segmentsX, y / segmentsY); } - var totalSub = segmentsX * segmentsY; - - for (var i$1 = 0; i$1 < totalSub; i$1++) - { - var xpos = i$1 % segmentsX; - var ypos = (i$1 / segmentsX) | 0; - + for (var i = 0; i < totalSub; i++) { + var xpos = i % segmentsX; + var ypos = (i / segmentsX) | 0; var value = (ypos * this.segWidth) + xpos; var value2 = (ypos * this.segWidth) + xpos + 1; var value3 = ((ypos + 1) * this.segWidth) + xpos; var value4 = ((ypos + 1) * this.segWidth) + xpos + 1; - - indices.push(value, value2, value3, - value2, value4, value3); + indices.push(value, value2, value3, value2, value4, value3); } - this.buffers[0].data = new Float32Array(verts); this.buffers[1].data = new Float32Array(uvs); this.indexBuffer.data = new Uint16Array(indices); - // ensure that the changes are uploaded this.buffers[0].update(); this.buffers[1].update(); this.indexBuffer.update(); }; - return PlaneGeometry; }(MeshGeometry)); @@ -47977,202 +44921,168 @@ var PIXI = (function (exports) { * @memberof PIXI * */ - var RopeGeometry = /*@__PURE__*/(function (MeshGeometry) { - function RopeGeometry(width, points, textureScale) - { - if ( width === void 0 ) { width = 200; } - if ( textureScale === void 0 ) { textureScale = 0; } - - MeshGeometry.call(this, new Float32Array(points.length * 4), - new Float32Array(points.length * 4), - new Uint16Array((points.length - 1) * 6)); - + var RopeGeometry = /** @class */ (function (_super) { + __extends$j(RopeGeometry, _super); + /** + * @param {number} [width=200] - The width (i.e., thickness) of the rope. + * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope. + * @param {number} [textureScale=0] - By default the rope texture will be stretched to match + * rope length. If textureScale is positive this value will be treated as a scaling + * factor and the texture will preserve its aspect ratio instead. To create a tiling rope + * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture, + * then set textureScale=1 to keep the original texture pixel size. + * In order to reduce alpha channel artifacts provide a larger texture and downsample - + * i.e. set textureScale=0.5 to scale it down twice. + */ + function RopeGeometry(width, points, textureScale) { + if (width === void 0) { width = 200; } + if (textureScale === void 0) { textureScale = 0; } + var _this = _super.call(this, new Float32Array(points.length * 4), new Float32Array(points.length * 4), new Uint16Array((points.length - 1) * 6)) || this; /** * An array of points that determine the rope * @member {PIXI.Point[]} */ - this.points = points; - + _this.points = points; /** * The width (i.e., thickness) of the rope. * @member {number} * @readOnly */ - this.width = width; - + _this._width = width; /** * Rope texture scale, if zero then the rope texture is stretched. * @member {number} * @readOnly */ - this.textureScale = textureScale; - - this.build(); + _this.textureScale = textureScale; + _this.build(); + return _this; } - - if ( MeshGeometry ) { RopeGeometry.__proto__ = MeshGeometry; } - RopeGeometry.prototype = Object.create( MeshGeometry && MeshGeometry.prototype ); - RopeGeometry.prototype.constructor = RopeGeometry; + Object.defineProperty(RopeGeometry.prototype, "width", { + /** + * The width (i.e., thickness) of the rope. + * @member {number} + * @readOnly + */ + get: function () { + return this._width; + }, + enumerable: false, + configurable: true + }); /** * Refreshes Rope indices and uvs * @private */ - RopeGeometry.prototype.build = function build () - { + RopeGeometry.prototype.build = function () { var points = this.points; - - if (!points) { return; } - + if (!points) + { return; } var vertexBuffer = this.getBuffer('aVertexPosition'); var uvBuffer = this.getBuffer('aTextureCoord'); var indexBuffer = this.getIndex(); - // if too little points, or texture hasn't got UVs set yet just move on. - if (points.length < 1) - { + if (points.length < 1) { return; } - // if the number of points has changed we will need to recreate the arraybuffers - if (vertexBuffer.data.length / 4 !== points.length) - { + if (vertexBuffer.data.length / 4 !== points.length) { vertexBuffer.data = new Float32Array(points.length * 4); uvBuffer.data = new Float32Array(points.length * 4); indexBuffer.data = new Uint16Array((points.length - 1) * 6); } - var uvs = uvBuffer.data; var indices = indexBuffer.data; - uvs[0] = 0; uvs[1] = 0; uvs[2] = 0; uvs[3] = 1; - var amount = 0; var prev = points[0]; - var textureWidth = this.width * this.textureScale; + var textureWidth = this._width * this.textureScale; var total = points.length; // - 1; - - for (var i = 0; i < total; i++) - { + for (var i = 0; i < total; i++) { // time to do some smart drawing! var index = i * 4; - - if (this.textureScale > 0) - { + if (this.textureScale > 0) { // calculate pixel distance from previous point var dx = prev.x - points[i].x; var dy = prev.y - points[i].y; var distance = Math.sqrt((dx * dx) + (dy * dy)); - prev = points[i]; amount += distance / textureWidth; } - else - { + else { // stretch texture amount = i / (total - 1); } - uvs[index] = amount; uvs[index + 1] = 0; - uvs[index + 2] = amount; uvs[index + 3] = 1; } - var indexCount = 0; - - for (var i$1 = 0; i$1 < total - 1; i$1++) - { - var index$1 = i$1 * 2; - - indices[indexCount++] = index$1; - indices[indexCount++] = index$1 + 1; - indices[indexCount++] = index$1 + 2; - - indices[indexCount++] = index$1 + 2; - indices[indexCount++] = index$1 + 1; - indices[indexCount++] = index$1 + 3; + for (var i = 0; i < total - 1; i++) { + var index = i * 2; + indices[indexCount++] = index; + indices[indexCount++] = index + 1; + indices[indexCount++] = index + 2; + indices[indexCount++] = index + 2; + indices[indexCount++] = index + 1; + indices[indexCount++] = index + 3; } - // ensure that the changes are uploaded uvBuffer.update(); indexBuffer.update(); - this.updateVertices(); }; - /** * refreshes vertices of Rope mesh */ - RopeGeometry.prototype.updateVertices = function updateVertices () - { + RopeGeometry.prototype.updateVertices = function () { var points = this.points; - - if (points.length < 1) - { + if (points.length < 1) { return; } - var lastPoint = points[0]; var nextPoint; var perpX = 0; var perpY = 0; - var vertices = this.buffers[0].data; var total = points.length; - - for (var i = 0; i < total; i++) - { + for (var i = 0; i < total; i++) { var point = points[i]; var index = i * 4; - - if (i < points.length - 1) - { + if (i < points.length - 1) { nextPoint = points[i + 1]; } - else - { + else { nextPoint = point; } - perpY = -(nextPoint.x - lastPoint.x); perpX = nextPoint.y - lastPoint.y; - var perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY)); - var num = this.textureScale > 0 ? this.textureScale * this.width / 2 : this.width / 2; - + var num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2; perpX /= perpLength; perpY /= perpLength; - perpX *= num; perpY *= num; - vertices[index] = point.x + perpX; vertices[index + 1] = point.y + perpY; vertices[index + 2] = point.x - perpX; vertices[index + 3] = point.y - perpY; - lastPoint = point; } - this.buffers[0].update(); }; - - RopeGeometry.prototype.update = function update () - { - if (this.textureScale > 0) - { + RopeGeometry.prototype.update = function () { + if (this.textureScale > 0) { this.build(); // we need to update UVs } - else - { + else { this.updateVertices(); } }; - return RopeGeometry; }(MeshGeometry)); @@ -48191,45 +45101,41 @@ var PIXI = (function (exports) { * @memberof PIXI * */ - var SimpleRope = /*@__PURE__*/(function (Mesh) { - function SimpleRope(texture, points, textureScale) - { - if ( textureScale === void 0 ) { textureScale = 0; } - + var SimpleRope = /** @class */ (function (_super) { + __extends$j(SimpleRope, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the rope. + * @param {PIXI.Point[]} points - An array of {@link PIXI.Point} objects to construct this rope. + * @param {number} [textureScale=0] - Optional. Positive values scale rope texture + * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture + * and downsampling here. If set to zero, texture will be streched instead. + */ + function SimpleRope(texture, points, textureScale) { + if (textureScale === void 0) { textureScale = 0; } + var _this = this; var ropeGeometry = new RopeGeometry(texture.height, points, textureScale); var meshMaterial = new MeshMaterial(texture); - - if (textureScale > 0) - { + if (textureScale > 0) { // attempt to set UV wrapping, will fail on non-power of two textures texture.baseTexture.wrapMode = exports.WRAP_MODES.REPEAT; } - Mesh.call(this, ropeGeometry, meshMaterial); - + _this = _super.call(this, ropeGeometry, meshMaterial) || this; /** * re-calculate vertices by rope points each frame * * @member {boolean} */ - this.autoUpdate = true; + _this.autoUpdate = true; + return _this; } - - if ( Mesh ) { SimpleRope.__proto__ = Mesh; } - SimpleRope.prototype = Object.create( Mesh && Mesh.prototype ); - SimpleRope.prototype.constructor = SimpleRope; - - SimpleRope.prototype._render = function _render (renderer) - { - if (this.autoUpdate - || this.geometry.width !== this.shader.texture.height) - { - this.geometry.width = this.shader.texture.height; - this.geometry.update(); + SimpleRope.prototype._render = function (renderer) { + var geometry = this.geometry; + if (this.autoUpdate || geometry._width !== this.shader.texture.height) { + geometry._width = this.shader.texture.height; + geometry.update(); } - - Mesh.prototype._render.call(this, renderer); + _super.prototype._render.call(this, renderer); }; - return SimpleRope; }(Mesh)); @@ -48248,79 +45154,62 @@ var PIXI = (function (exports) { * @memberof PIXI * */ - var SimplePlane = /*@__PURE__*/(function (Mesh) { - function SimplePlane(texture, verticesX, verticesY) - { + var SimplePlane = /** @class */ (function (_super) { + __extends$j(SimplePlane, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the SimplePlane. + * @param {number} verticesX - The number of vertices in the x-axis + * @param {number} verticesY - The number of vertices in the y-axis + */ + function SimplePlane(texture, verticesX, verticesY) { + var _this = this; var planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY); var meshMaterial = new MeshMaterial(Texture.WHITE); - - Mesh.call(this, planeGeometry, meshMaterial); - + _this = _super.call(this, planeGeometry, meshMaterial) || this; // lets call the setter to ensure all necessary updates are performed - this.texture = texture; + _this.texture = texture; + return _this; } - - if ( Mesh ) { SimplePlane.__proto__ = Mesh; } - SimplePlane.prototype = Object.create( Mesh && Mesh.prototype ); - SimplePlane.prototype.constructor = SimplePlane; - - var prototypeAccessors = { texture: { configurable: true } }; - /** * Method used for overrides, to do something in case texture frame was changed. * Meshes based on plane can override it and change more details based on texture. */ - SimplePlane.prototype.textureUpdated = function textureUpdated () - { + SimplePlane.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(); + var geometry = this.geometry; + geometry.width = this.shader.texture.width; + geometry.height = this.shader.texture.height; + geometry.build(); }; - - prototypeAccessors.texture.set = function (value) - { - // Track texture same way sprite does. - // For generated meshes like NineSlicePlane it can change the geometry. - // Unfortunately, this method might not work if you directly change texture in material. - - if (this.shader.texture === value) - { - return; - } - - this.shader.texture = value; - this._textureID = -1; - - if (value.baseTexture.valid) - { + Object.defineProperty(SimplePlane.prototype, "texture", { + get: function () { + return this.shader.texture; + }, + set: function (value) { + // Track texture same way sprite does. + // For generated meshes like NineSlicePlane it can change the geometry. + // Unfortunately, this method might not work if you directly change texture in material. + if (this.shader.texture === value) { + return; + } + this.shader.texture = value; + this._textureID = -1; + if (value.baseTexture.valid) { + this.textureUpdated(); + } + else { + value.once('update', this.textureUpdated, this); + } + }, + enumerable: false, + configurable: true + }); + SimplePlane.prototype._render = function (renderer) { + if (this._textureID !== this.shader.texture._updateID) { this.textureUpdated(); } - else - { - value.once('update', this.textureUpdated, this); - } + _super.prototype._render.call(this, renderer); }; - - prototypeAccessors.texture.get = function () - { - return this.shader.texture; - }; - - SimplePlane.prototype._render = function _render (renderer) - { - if (this._textureID !== this.shader.texture._updateID) - { - this.textureUpdated(); - } - - Mesh.prototype._render.call(this, renderer); - }; - - Object.defineProperties( SimplePlane.prototype, prototypeAccessors ); - return SimplePlane; }(Mesh)); @@ -48332,62 +45221,53 @@ var PIXI = (function (exports) { * @extends PIXI.Mesh * @memberof PIXI */ - var SimpleMesh = /*@__PURE__*/(function (Mesh) { - function SimpleMesh(texture, vertices, uvs, indices, drawMode) - { - if ( texture === void 0 ) { texture = Texture.EMPTY; } - + var SimpleMesh = /** @class */ (function (_super) { + __extends$j(SimpleMesh, _super); + /** + * @param {PIXI.Texture} [texture=Texture.EMPTY] - The texture to use + * @param {Float32Array} [vertices] - if you want to specify the vertices + * @param {Float32Array} [uvs] - if you want to specify the uvs + * @param {Uint16Array} [indices] - if you want to specify the indices + * @param {number} [drawMode] - the drawMode, can be any of the Mesh.DRAW_MODES consts + */ + function SimpleMesh(texture, vertices, uvs, indices, drawMode) { + if (texture === void 0) { texture = Texture.EMPTY; } + var _this = this; var geometry = new MeshGeometry(vertices, uvs, indices); - geometry.getBuffer('aVertexPosition').static = false; - var meshMaterial = new MeshMaterial(texture); - - Mesh.call(this, geometry, meshMaterial, null, drawMode); - + _this = _super.call(this, geometry, meshMaterial, null, drawMode) || this; /** * upload vertices buffer each frame * @member {boolean} */ - this.autoUpdate = true; + _this.autoUpdate = true; + return _this; } - - if ( Mesh ) { SimpleMesh.__proto__ = Mesh; } - SimpleMesh.prototype = Object.create( Mesh && Mesh.prototype ); - SimpleMesh.prototype.constructor = SimpleMesh; - - var prototypeAccessors = { vertices: { configurable: true } }; - - /** - * Collection of vertices data. - * @member {Float32Array} - */ - prototypeAccessors.vertices.get = function () - { - return this.geometry.getBuffer('aVertexPosition').data; - }; - prototypeAccessors.vertices.set = function (value) - { - this.geometry.getBuffer('aVertexPosition').data = value; - }; - - SimpleMesh.prototype._render = function _render (renderer) - { - if (this.autoUpdate) - { + Object.defineProperty(SimpleMesh.prototype, "vertices", { + /** + * Collection of vertices data. + * @member {Float32Array} + */ + get: function () { + return this.geometry.getBuffer('aVertexPosition').data; + }, + set: function (value) { + this.geometry.getBuffer('aVertexPosition').data = value; + }, + enumerable: false, + configurable: true + }); + SimpleMesh.prototype._render = function (renderer) { + if (this.autoUpdate) { this.geometry.getBuffer('aVertexPosition').update(); } - - Mesh.prototype._render.call(this, renderer); + _super.prototype._render.call(this, renderer); }; - - Object.defineProperties( SimpleMesh.prototype, prototypeAccessors ); - return SimpleMesh; }(Mesh)); var DEFAULT_BORDER_SIZE = 10; - /** * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically @@ -48419,278 +45299,278 @@ var PIXI = (function (exports) { * @memberof PIXI * */ - var NineSlicePlane = /*@__PURE__*/(function (SimplePlane) { - function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) - { - SimplePlane.call(this, Texture.WHITE, 4, 4); - - this._origWidth = texture.orig.width; - this._origHeight = texture.orig.height; - + var NineSlicePlane = /** @class */ (function (_super) { + __extends$j(NineSlicePlane, _super); + /** + * @param {PIXI.Texture} texture - The texture to use on the NineSlicePlane. + * @param {number} [leftWidth=10] - size of the left vertical bar (A) + * @param {number} [topHeight=10] - size of the top horizontal bar (C) + * @param {number} [rightWidth=10] - size of the right vertical bar (B) + * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D) + */ + function NineSlicePlane(texture, leftWidth, topHeight, rightWidth, bottomHeight) { + if (leftWidth === void 0) { leftWidth = DEFAULT_BORDER_SIZE; } + if (topHeight === void 0) { topHeight = DEFAULT_BORDER_SIZE; } + if (rightWidth === void 0) { rightWidth = DEFAULT_BORDER_SIZE; } + if (bottomHeight === void 0) { bottomHeight = DEFAULT_BORDER_SIZE; } + var _this = _super.call(this, Texture.WHITE, 4, 4) || this; + _this._origWidth = texture.orig.width; + _this._origHeight = texture.orig.height; /** * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} * @override */ - this._width = this._origWidth; - + _this._width = _this._origWidth; /** * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane * * @member {number} * @override */ - this._height = this._origHeight; - + _this._height = _this._origHeight; /** * The width of the left column (a) * * @member {number} * @private */ - this._leftWidth = typeof leftWidth !== 'undefined' ? leftWidth : DEFAULT_BORDER_SIZE; - + _this._leftWidth = leftWidth; /** * The width of the right column (b) * * @member {number} * @private */ - this._rightWidth = typeof rightWidth !== 'undefined' ? rightWidth : DEFAULT_BORDER_SIZE; - + _this._rightWidth = rightWidth; /** * The height of the top row (c) * * @member {number} * @private */ - this._topHeight = typeof topHeight !== 'undefined' ? topHeight : DEFAULT_BORDER_SIZE; - + _this._topHeight = topHeight; /** * The height of the bottom row (d) * * @member {number} * @private */ - this._bottomHeight = typeof bottomHeight !== 'undefined' ? bottomHeight : DEFAULT_BORDER_SIZE; - + _this._bottomHeight = bottomHeight; // lets call the setter to ensure all necessary updates are performed - this.texture = texture; + _this.texture = texture; + return _this; } - - if ( SimplePlane ) { NineSlicePlane.__proto__ = SimplePlane; } - NineSlicePlane.prototype = Object.create( SimplePlane && SimplePlane.prototype ); - NineSlicePlane.prototype.constructor = NineSlicePlane; - - var prototypeAccessors = { vertices: { configurable: true },width: { configurable: true },height: { configurable: true },leftWidth: { configurable: true },rightWidth: { configurable: true },topHeight: { configurable: true },bottomHeight: { configurable: true } }; - - NineSlicePlane.prototype.textureUpdated = function textureUpdated () - { + NineSlicePlane.prototype.textureUpdated = function () { this._textureID = this.shader.texture._updateID; this._refresh(); }; - - prototypeAccessors.vertices.get = function () - { - return this.geometry.getBuffer('aVertexPosition').data; - }; - - prototypeAccessors.vertices.set = function (value) - { - this.geometry.getBuffer('aVertexPosition').data = value; - }; - + Object.defineProperty(NineSlicePlane.prototype, "vertices", { + get: function () { + return this.geometry.getBuffer('aVertexPosition').data; + }, + set: function (value) { + this.geometry.getBuffer('aVertexPosition').data = value; + }, + enumerable: false, + configurable: true + }); /** * Updates the horizontal vertices. * */ - NineSlicePlane.prototype.updateHorizontalVertices = function updateHorizontalVertices () - { + NineSlicePlane.prototype.updateHorizontalVertices = function () { var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale; vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale); vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height; }; - /** * Updates the vertical vertices. * */ - NineSlicePlane.prototype.updateVerticalVertices = function updateVerticalVertices () - { + NineSlicePlane.prototype.updateVerticalVertices = function () { var vertices = this.vertices; - var scale = this._getMinScale(); - vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale; vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale); vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width; }; - /** * Returns the smaller of a set of vertical and horizontal scale of nine slice corners. * * @return {number} Smaller number of vertical and horizontal scale. * @private */ - NineSlicePlane.prototype._getMinScale = function _getMinScale () - { + NineSlicePlane.prototype._getMinScale = function () { var w = this._leftWidth + this._rightWidth; var scaleW = this._width > w ? 1.0 : this._width / w; - var h = this._topHeight + this._bottomHeight; var scaleH = this._height > h ? 1.0 : this._height / h; - var scale = Math.min(scaleW, scaleH); - return scale; }; - - /** - * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - prototypeAccessors.width.get = function () - { - return this._width; - }; - - prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc - { - this._width = value; - this._refresh(); - }; - - /** - * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane - * - * @member {number} - */ - prototypeAccessors.height.get = function () - { - return this._height; - }; - - prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc - { - this._height = value; - this._refresh(); - }; - - /** - * The width of the left column - * - * @member {number} - */ - prototypeAccessors.leftWidth.get = function () - { - return this._leftWidth; - }; - - prototypeAccessors.leftWidth.set = function (value) // eslint-disable-line require-jsdoc - { - this._leftWidth = value; - this._refresh(); - }; - - /** - * The width of the right column - * - * @member {number} - */ - prototypeAccessors.rightWidth.get = function () - { - return this._rightWidth; - }; - - prototypeAccessors.rightWidth.set = function (value) // eslint-disable-line require-jsdoc - { - this._rightWidth = value; - this._refresh(); - }; - - /** - * The height of the top row - * - * @member {number} - */ - prototypeAccessors.topHeight.get = function () - { - return this._topHeight; - }; - - prototypeAccessors.topHeight.set = function (value) // eslint-disable-line require-jsdoc - { - this._topHeight = value; - this._refresh(); - }; - - /** - * The height of the bottom row - * - * @member {number} - */ - prototypeAccessors.bottomHeight.get = function () - { - return this._bottomHeight; - }; - - prototypeAccessors.bottomHeight.set = function (value) // eslint-disable-line require-jsdoc - { - this._bottomHeight = value; - this._refresh(); - }; - + Object.defineProperty(NineSlicePlane.prototype, "width", { + /** + * The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + get: function () { + return this._width; + }, + set: function (value) { + this._width = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "height", { + /** + * The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane + * + * @member {number} + */ + get: function () { + return this._height; + }, + set: function (value) { + this._height = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "leftWidth", { + /** + * The width of the left column + * + * @member {number} + */ + get: function () { + return this._leftWidth; + }, + set: function (value) { + this._leftWidth = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "rightWidth", { + /** + * The width of the right column + * + * @member {number} + */ + get: function () { + return this._rightWidth; + }, + set: function (value) { + this._rightWidth = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "topHeight", { + /** + * The height of the top row + * + * @member {number} + */ + get: function () { + return this._topHeight; + }, + set: function (value) { + this._topHeight = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NineSlicePlane.prototype, "bottomHeight", { + /** + * The height of the bottom row + * + * @member {number} + */ + get: function () { + return this._bottomHeight; + }, + set: function (value) { + this._bottomHeight = value; + this._refresh(); + }, + enumerable: false, + configurable: true + }); /** * Refreshes NineSlicePlane coords. All of them. */ - NineSlicePlane.prototype._refresh = function _refresh () - { + NineSlicePlane.prototype._refresh = function () { var texture = this.texture; - var uvs = this.geometry.buffers[1].data; - this._origWidth = texture.orig.width; this._origHeight = texture.orig.height; - var _uvw = 1.0 / this._origWidth; var _uvh = 1.0 / this._origHeight; - uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0; uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0; uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1; uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1; - uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth; uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth); uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight; uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight); - this.updateHorizontalVertices(); this.updateVerticalVertices(); - this.geometry.buffers[0].update(); this.geometry.buffers[1].update(); }; - - Object.defineProperties( NineSlicePlane.prototype, prototypeAccessors ); - return NineSlicePlane; }(SimplePlane)); /*! - * @pixi/sprite-animated - v5.2.1 - * Compiled Tue, 28 Jan 2020 23:33:11 UTC + * @pixi/sprite-animated - v5.3.3 + * Compiled Tue, 04 Aug 2020 16:23:09 UTC * * @pixi/sprite-animated is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics$k = function(d, b) { + extendStatics$k = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } }; + return extendStatics$k(d, b); + }; + + function __extends$k(d, b) { + extendStatics$k(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + /** * An AnimatedSprite is a simple way to display an animation depicted by a list of textures. * @@ -48724,49 +45604,56 @@ var PIXI = (function (exports) { * @extends PIXI.Sprite * @memberof PIXI */ - var AnimatedSprite = /*@__PURE__*/(function (Sprite) { - function AnimatedSprite(textures, autoUpdate) - { - Sprite.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture); - + var AnimatedSprite = /** @class */ (function (_super) { + __extends$k(AnimatedSprite, _super); + /** + * @param {PIXI.Texture[]|PIXI.AnimatedSprite.FrameObject[]} textures - An array of {@link PIXI.Texture} or frame + * objects that make up the animation. + * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time. + */ + function AnimatedSprite(textures, autoUpdate) { + if (autoUpdate === void 0) { autoUpdate = true; } + var _this = _super.call(this, textures[0] instanceof Texture ? textures[0] : textures[0].texture) || this; /** * @type {PIXI.Texture[]} * @private */ - this._textures = null; - + _this._textures = null; /** * @type {number[]} * @private */ - this._durations = null; - - this.textures = textures; - + _this._durations = null; /** * `true` uses PIXI.Ticker.shared to auto update animation time. + * * @type {boolean} * @default true * @private */ - this._autoUpdate = autoUpdate !== false; - + _this._autoUpdate = autoUpdate; + /** + * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time. + * + * @type {boolean} + * @default false + * @private + */ + _this._isConnectedToTicker = false; /** * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower. * * @member {number} * @default 1 */ - this.animationSpeed = 1; - + _this.animationSpeed = 1; /** * Whether or not the animate sprite repeats after playing. * * @member {boolean} * @default true */ - this.loop = true; - + _this.loop = true; /** * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes. * @@ -48779,228 +45666,183 @@ var PIXI = (function (exports) { * @member {boolean} * @default false */ - this.updateAnchor = false; - + _this.updateAnchor = false; /** - * Function to call when an AnimatedSprite finishes playing. + * User-assigned function to call when an AnimatedSprite finishes playing. * + * @example + * animation.onComplete = function () { + * // finished! + * }; * @member {Function} */ - this.onComplete = null; - + _this.onComplete = null; /** - * Function to call when an AnimatedSprite changes which texture is being rendered. + * User-assigned function to call when an AnimatedSprite changes which texture is being rendered. * + * @example + * animation.onFrameChange = function () { + * // updated! + * }; * @member {Function} */ - this.onFrameChange = null; - + _this.onFrameChange = null; /** - * Function to call when `loop` is true, and an AnimatedSprite is played and loops around to start again. + * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and + * loops around to start again. * + * @example + * animation.onLoop = function () { + * // looped! + * }; * @member {Function} */ - this.onLoop = null; - + _this.onLoop = null; /** * Elapsed time since animation has been started, used internally to display current texture. * * @member {number} * @private */ - this._currentTime = 0; - + _this._currentTime = 0; + _this._playing = false; /** - * Indicates if the AnimatedSprite is currently playing. + * The texture index that was displayed last time * - * @member {boolean} - * @readonly + * @member {number} + * @private */ - this.playing = false; + _this._previousFrame = null; + _this.textures = textures; + return _this; } - - if ( Sprite ) { AnimatedSprite.__proto__ = Sprite; } - AnimatedSprite.prototype = Object.create( Sprite && Sprite.prototype ); - AnimatedSprite.prototype.constructor = AnimatedSprite; - - var prototypeAccessors = { totalFrames: { configurable: true },textures: { configurable: true },currentFrame: { configurable: true } }; - /** * Stops the AnimatedSprite. * */ - AnimatedSprite.prototype.stop = function stop () - { - if (!this.playing) - { + AnimatedSprite.prototype.stop = function () { + if (!this._playing) { return; } - - this.playing = false; - if (this._autoUpdate) - { + this._playing = false; + if (this._autoUpdate && this._isConnectedToTicker) { Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; } }; - /** * Plays the AnimatedSprite. * */ - AnimatedSprite.prototype.play = function play () - { - if (this.playing) - { + AnimatedSprite.prototype.play = function () { + if (this._playing) { return; } - - this.playing = true; - if (this._autoUpdate) - { + this._playing = true; + if (this._autoUpdate && !this._isConnectedToTicker) { Ticker.shared.add(this.update, this, exports.UPDATE_PRIORITY.HIGH); + this._isConnectedToTicker = true; } }; - /** * Stops the AnimatedSprite and goes to a specific frame. * * @param {number} frameNumber - Frame index to stop at. */ - AnimatedSprite.prototype.gotoAndStop = function gotoAndStop (frameNumber) - { + AnimatedSprite.prototype.gotoAndStop = function (frameNumber) { this.stop(); - var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - - if (previousFrame !== this.currentFrame) - { + if (previousFrame !== this.currentFrame) { this.updateTexture(); } }; - /** * Goes to a specific frame and begins playing the AnimatedSprite. * * @param {number} frameNumber - Frame index to start at. */ - AnimatedSprite.prototype.gotoAndPlay = function gotoAndPlay (frameNumber) - { + AnimatedSprite.prototype.gotoAndPlay = function (frameNumber) { var previousFrame = this.currentFrame; - this._currentTime = frameNumber; - - if (previousFrame !== this.currentFrame) - { + if (previousFrame !== this.currentFrame) { this.updateTexture(); } - this.play(); }; - /** * Updates the object transform for rendering. * - * @private * @param {number} deltaTime - Time since last tick. */ - AnimatedSprite.prototype.update = function update (deltaTime) - { + AnimatedSprite.prototype.update = function (deltaTime) { var elapsed = this.animationSpeed * deltaTime; var previousFrame = this.currentFrame; - - if (this._durations !== null) - { + if (this._durations !== null) { var lag = this._currentTime % 1 * this._durations[this.currentFrame]; - lag += elapsed / 60 * 1000; - - while (lag < 0) - { + while (lag < 0) { this._currentTime--; lag += this._durations[this.currentFrame]; } - var sign = Math.sign(this.animationSpeed * deltaTime); - this._currentTime = Math.floor(this._currentTime); - - while (lag >= this._durations[this.currentFrame]) - { + while (lag >= this._durations[this.currentFrame]) { lag -= this._durations[this.currentFrame] * sign; this._currentTime += sign; } - this._currentTime += lag / this._durations[this.currentFrame]; } - else - { + else { this._currentTime += elapsed; } - - if (this._currentTime < 0 && !this.loop) - { - this._currentTime = 0; - this.stop(); - - if (this.onComplete) - { + if (this._currentTime < 0 && !this.loop) { + this.gotoAndStop(0); + if (this.onComplete) { this.onComplete(); } } - else if (this._currentTime >= this._textures.length && !this.loop) - { - this._currentTime = this._textures.length - 1; - this.stop(); - - if (this.onComplete) - { + else if (this._currentTime >= this._textures.length && !this.loop) { + this.gotoAndStop(this._textures.length - 1); + if (this.onComplete) { this.onComplete(); } } - else if (previousFrame !== this.currentFrame) - { - if (this.loop && this.onLoop) - { - if (this.animationSpeed > 0 && this.currentFrame < previousFrame) - { + else if (previousFrame !== this.currentFrame) { + if (this.loop && this.onLoop) { + if (this.animationSpeed > 0 && this.currentFrame < previousFrame) { this.onLoop(); } - else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) - { + else if (this.animationSpeed < 0 && this.currentFrame > previousFrame) { this.onLoop(); } } - this.updateTexture(); } }; - /** * Updates the displayed texture to match the current frame index. * * @private */ - AnimatedSprite.prototype.updateTexture = function updateTexture () - { - this._texture = this._textures[this.currentFrame]; + AnimatedSprite.prototype.updateTexture = function () { + var currentFrame = this.currentFrame; + if (this._previousFrame === currentFrame) { + return; + } + this._previousFrame = currentFrame; + this._texture = this._textures[currentFrame]; this._textureID = -1; this._textureTrimmedID = -1; this._cachedTint = 0xFFFFFF; this.uvs = this._texture._uvs.uvsFloat32; - - if (this.updateAnchor) - { + if (this.updateAnchor) { this._anchor.copyFrom(this._texture.defaultAnchor); } - - if (this.onFrameChange) - { + if (this.onFrameChange) { this.onFrameChange(this.currentFrame); } }; - /** * Stops the AnimatedSprite and destroys it. * @@ -49011,119 +45853,140 @@ var PIXI = (function (exports) { * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well. * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well. */ - AnimatedSprite.prototype.destroy = function destroy (options) - { + AnimatedSprite.prototype.destroy = function (options) { this.stop(); - Sprite.prototype.destroy.call(this, options); - + _super.prototype.destroy.call(this, options); this.onComplete = null; this.onFrameChange = null; this.onLoop = null; }; - /** * A short hand way of creating an AnimatedSprite from an array of frame ids. * * @static * @param {string[]} frames - The array of frames ids the AnimatedSprite will use as its texture frames. - * @return {AnimatedSprite} The new animated sprite with the specified frames. + * @return {PIXI.AnimatedSprite} The new animated sprite with the specified frames. */ - AnimatedSprite.fromFrames = function fromFrames (frames) - { + AnimatedSprite.fromFrames = function (frames) { var textures = []; - - for (var i = 0; i < frames.length; ++i) - { + for (var i = 0; i < frames.length; ++i) { textures.push(Texture.from(frames[i])); } - return new AnimatedSprite(textures); }; - /** * A short hand way of creating an AnimatedSprite from an array of image ids. * * @static * @param {string[]} images - The array of image urls the AnimatedSprite will use as its texture frames. - * @return {AnimatedSprite} The new animate sprite with the specified images as frames. + * @return {PIXI.AnimatedSprite} The new animate sprite with the specified images as frames. */ - AnimatedSprite.fromImages = function fromImages (images) - { + AnimatedSprite.fromImages = function (images) { var textures = []; - - for (var i = 0; i < images.length; ++i) - { + for (var i = 0; i < images.length; ++i) { textures.push(Texture.from(images[i])); } - return new AnimatedSprite(textures); }; - - /** - * The total number of frames in the AnimatedSprite. This is the same as number of textures - * assigned to the AnimatedSprite. - * - * @readonly - * @member {number} - * @default 0 - */ - prototypeAccessors.totalFrames.get = function () - { - return this._textures.length; - }; - - /** - * The array of textures used for this AnimatedSprite. - * - * @member {PIXI.Texture[]} - */ - prototypeAccessors.textures.get = function () - { - return this._textures; - }; - - prototypeAccessors.textures.set = function (value) // eslint-disable-line require-jsdoc - { - if (value[0] instanceof Texture) - { - this._textures = value; - this._durations = null; - } - else - { - this._textures = []; - this._durations = []; - - for (var i = 0; i < value.length; i++) - { - this._textures.push(value[i].texture); - this._durations.push(value[i].time); + Object.defineProperty(AnimatedSprite.prototype, "totalFrames", { + /** + * The total number of frames in the AnimatedSprite. This is the same as number of textures + * assigned to the AnimatedSprite. + * + * @readonly + * @member {number} + * @default 0 + */ + get: function () { + return this._textures.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "textures", { + /** + * The array of textures used for this AnimatedSprite. + * + * @member {PIXI.Texture[]} + */ + get: function () { + return this._textures; + }, + set: function (value) { + if (value[0] instanceof Texture) { + this._textures = value; + this._durations = null; } - } - this.gotoAndStop(0); - this.updateTexture(); - }; - - /** - * The AnimatedSprites current frame index. - * - * @member {number} - * @readonly - */ - prototypeAccessors.currentFrame.get = function () - { - var currentFrame = Math.floor(this._currentTime) % this._textures.length; - - if (currentFrame < 0) - { - currentFrame += this._textures.length; - } - - return currentFrame; - }; - - Object.defineProperties( AnimatedSprite.prototype, prototypeAccessors ); - + else { + this._textures = []; + this._durations = []; + for (var i = 0; i < value.length; i++) { + this._textures.push(value[i].texture); + this._durations.push(value[i].time); + } + } + this._previousFrame = null; + this.gotoAndStop(0); + this.updateTexture(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "currentFrame", { + /** + * The AnimatedSprites current frame index. + * + * @member {number} + * @readonly + */ + get: function () { + var currentFrame = Math.floor(this._currentTime) % this._textures.length; + if (currentFrame < 0) { + currentFrame += this._textures.length; + } + return currentFrame; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "playing", { + /** + * Indicates if the AnimatedSprite is currently playing. + * + * @member {boolean} + * @readonly + */ + get: function () { + return this._playing; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnimatedSprite.prototype, "autoUpdate", { + /** + * Whether to use PIXI.Ticker.shared to auto update animation time + * + * @member {boolean} + */ + get: function () { + return this._autoUpdate; + }, + set: function (value) { + if (value !== this._autoUpdate) { + this._autoUpdate = value; + if (!this._autoUpdate && this._isConnectedToTicker) { + Ticker.shared.remove(this.update, this); + this._isConnectedToTicker = false; + } + else if (this._autoUpdate && !this._isConnectedToTicker && this._playing) { + Ticker.shared.add(this.update, this); + this._isConnectedToTicker = true; + } + } + }, + enumerable: false, + configurable: true + }); return AnimatedSprite; }(Sprite)); @@ -49135,13 +45998,10 @@ var PIXI = (function (exports) { Renderer.registerPlugin('prepare', Prepare); Renderer.registerPlugin('batch', BatchRenderer); Renderer.registerPlugin('tilingSprite', TilingSpriteRenderer); - Loader$1.registerPlugin(BitmapFontLoader); Loader$1.registerPlugin(SpritesheetLoader); - Application.registerPlugin(TickerPlugin); Application.registerPlugin(AppLoaderPlugin); - /** * String of the current PIXI version. * @@ -49151,12 +46011,10 @@ var PIXI = (function (exports) { * @name VERSION * @type {string} */ - var VERSION$1 = '5.2.1'; - + var VERSION$1 = '5.3.3'; /** * @namespace PIXI */ - /** * This namespace contains WebGL-only display filters that can be applied * to DisplayObjects using the {@link PIXI.DisplayObject#filters filters} property. @@ -49196,6 +46054,7 @@ var PIXI = (function (exports) { exports.AbstractBatchRenderer = AbstractBatchRenderer; exports.AbstractRenderer = AbstractRenderer; + exports.AccessibilityManager = AccessibilityManager; exports.AnimatedSprite = AnimatedSprite; exports.AppLoaderPlugin = AppLoaderPlugin; exports.Application = Application; @@ -49209,6 +46068,8 @@ var PIXI = (function (exports) { exports.BatchRenderer = BatchRenderer; exports.BatchShaderGenerator = BatchShaderGenerator; exports.BatchTextureArray = BatchTextureArray; + exports.BitmapFont = BitmapFont; + exports.BitmapFontData = BitmapFontData; exports.BitmapFontLoader = BitmapFontLoader; exports.BitmapText = BitmapText; exports.Bounds = Bounds; @@ -49216,14 +46077,15 @@ var PIXI = (function (exports) { exports.Circle = Circle; exports.Container = Container; exports.CountLimiter = CountLimiter; - exports.CubeTexture = CubeTexture; exports.DEG_TO_RAD = DEG_TO_RAD; exports.DisplayObject = DisplayObject; exports.Ellipse = Ellipse; exports.Extract = Extract; exports.FillStyle = FillStyle; exports.Filter = Filter; + exports.FilterState = FilterState; exports.Framebuffer = Framebuffer; + exports.GLFramebuffer = GLFramebuffer; exports.GLProgram = GLProgram; exports.GLTexture = GLTexture; exports.GRAPHICS_CURVES = GRAPHICS_CURVES; @@ -49231,6 +46093,11 @@ var PIXI = (function (exports) { exports.Graphics = Graphics; exports.GraphicsData = GraphicsData; exports.GraphicsGeometry = GraphicsGeometry; + exports.IGLUniformData = IGLUniformData; + exports.InteractionData = InteractionData; + exports.InteractionEvent = InteractionEvent; + exports.InteractionManager = InteractionManager; + exports.InteractionTrackingData = InteractionTrackingData; exports.LineStyle = LineStyle; exports.Loader = Loader$1; exports.LoaderResource = LoaderResource; @@ -49271,7 +46138,7 @@ var PIXI = (function (exports) { exports.SpritesheetLoader = SpritesheetLoader; exports.State = State; exports.System = System; - exports.TEXT_GRADIENT = TEXT_GRADIENT; + exports.TemporaryDisplayObject = TemporaryDisplayObject; exports.Text = Text; exports.TextMetrics = TextMetrics; exports.TextStyle = TextStyle; @@ -49288,7 +46155,7 @@ var PIXI = (function (exports) { exports.UniformGroup = UniformGroup; exports.VERSION = VERSION$1; exports.ViewableBuffer = ViewableBuffer; - exports.accessibility = accessibility_es; + exports.accessibleTarget = accessibleTarget; exports.autoDetectRenderer = autoDetectRenderer; exports.checkMaxIfStatementsInShader = checkMaxIfStatementsInShader; exports.defaultFilterVertex = defaultFilter; @@ -49296,11 +46163,12 @@ var PIXI = (function (exports) { exports.filters = filters; exports.graphicsUtils = index$2; exports.groupD8 = groupD8; - exports.interaction = interaction_es; + exports.interactiveTarget = interactiveTarget; exports.isMobile = isMobile$1; exports.resources = index; exports.settings = settings; exports.systems = systems; + exports.uniformParsers = uniformParsers; exports.useDeprecated = useDeprecated; exports.utils = utils_es; diff --git a/dist/iwmlib.3rdparty.min.js b/dist/iwmlib.3rdparty.min.js index 7ab66e2..e296eb4 100644 --- a/dist/iwmlib.3rdparty.min.js +++ b/dist/iwmlib.3rdparty.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OptimalSelect=t():e.OptimalSelect=t()}(this,function(){return function(r){var i={};function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=r,n.c=i,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertNodeList=function(e){for(var t=e.length,r=new Array(t),i=0;i@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);var n=[i.pop()];for(;1/g,"> ").trim()};var i,n=r(3),h=(i=n)&&i.__esModule?i:{default:i},c=r(0);function f(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(g(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[l];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,g(document.querySelectorAll(a),o)&&(i=e),"break"}},l=0,u=s.length;l/.test(i)){var h=i.replace(/>/,"");a=""+r+h+n;g(document.querySelectorAll(a),o)&&(i=h)}if(/:nth-child/.test(i)){var c=i.replace(/nth-child/g,"nth-of-type");a=""+r+c+n;g(document.querySelectorAll(a),o)&&(i=c)}if(/\.\S+\.\S+/.test(i)){for(var f=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var p=i.replace(f.shift(),"").trim();if(!(a=(""+r+p+n).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;g(document.querySelectorAll(a),o)&&(i=p)}if((f=i&&i.match(/\./g))&&2/.test(s):u=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");l=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=i.shift(),n=i.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,n,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===c||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;rt[r]}):i.sort()),i}function A(e,t){for(var r,i,n=t[0].toUpperCase()+t.slice(1),o=0;of(u.y)?u.x:u.y,t.scale=a?function(e,t){return ie(t[0],t[1],J)/ie(e[0],e[1],J)}(a.pointers,i):1,t.rotation=a?function(e,t){return ne(t[1],t[0],J)+ne(e[1],e[0],J)}(a.pointers,i):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,i,n,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=B&&(Lf(h.y)?h.x:h.y,o=re(l,u),e.lastInterval=t}else r=a.velocity,i=a.velocityX,n=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=i,t.velocityY=n,t.direction=o}(r,t);var h=e.element;T(t.srcEvent.target,h)&&(h=t.srcEvent.target);t.target=h}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function $(e){for(var t=[],r=0;r=f(t)?e<0?X:H:t<0?W:q}function ie(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return Math.sqrt(i*i+n*n)}function ne(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return 180*Math.atan2(n,i)/Math.PI}K.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:j,mousemove:2,mouseup:N},ae="mousedown",se="mousemove mouseup";function le(){this.evEl=ae,this.evWin=se,this.pressed=!1,K.apply(this,arguments)}v(le,K,{handler:function(e){var t=oe[e.type];t&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:F,srcEvent:e}))}});var ue={pointerdown:j,pointermove:2,pointerup:N,pointercancel:B,pointerout:B},he={2:z,3:"pen",4:F,5:"kinect"},ce="pointerdown",fe="pointermove pointerup pointercancel";function pe(){this.evEl=ce,this.evWin=fe,K.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ce="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),v(pe,K,{handler:function(e){var t=this.store,r=!1,i=e.type.toLowerCase().replace("ms",""),n=ue[i],o=he[e.pointerType]||e.pointerType,a=o==z,s=P(t,e.pointerId,"pointerId");n&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):n&(N|B)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var de={touchstart:j,touchmove:2,touchend:N,touchcancel:B};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,K.apply(this,arguments)}v(me,K,{handler:function(e){var t=de[e.type];if(t===j&&(this.started=!0),this.started){var r=function(e,t){var r=E(e.touches),i=E(e.changedTouches);t&(N|B)&&(r=C(r.concat(i),"identifier",!0));return[r,i]}.call(this,e,t);t&(N|B)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:z,srcEvent:e})}}});var ge={touchstart:j,touchmove:2,touchend:N,touchcancel:B},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},K.apply(this,arguments)}v(_e,K,{handler:function(e){var t=ge[e.type],r=function(e,t){var r=E(e.touches),i=this.targetIds;if(t&(2|j)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,a=E(e.changedTouches),s=[],l=this.target;if(o=r.filter(function(e){return T(e.target,l)}),t===j)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return Fe.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Re(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(je,Fe,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Ne,Me,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distancet.time;if(this._input=e,!i||!r||e.eventType&(N|B)&&!n)this.reset();else if(e.eventType&j)this.reset(),this._timer=u(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&N)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}}),v(Be,Fe,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Pe]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Fe,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:G|V,pointers:1},getTouchAction:function(){return Le.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(G|V)?t=e.overallVelocity:r&G?t=e.overallVelocityX:r&V&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&f(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Re(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Me,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Se]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distance80*r){i=o=e[0],n=a=e[1];for(var d=r;do.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,h=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,c=W(s,l,t,r,i),f=W(u,h,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=c&&d&&d.z<=f;){if(p!==e.prev&&p!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=Y(p.prev,p,p.next))return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Y(d.prev,d,d.next))return!1;d=d.nextZ}for(;p&&p.z>=c;){if(p!==e.prev&&p!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=Y(p.prev,p,p.next))return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==e.prev&&d!==e.next&&V(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=Y(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function B(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!Z(n,o)&&J(n,i,i.next,o)&&$(n,o)&&$(o,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(o.i/r),re(i),re(i.next),i=e=o),i=i.next}while(i!==e);return F(i)}function U(e,t,r,i,n,o){var a,s,l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&(s=u,(a=l).next.i!==s.i&&a.prev.i!==s.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&J(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&($(a,s)&&$(s,a)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;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,r!==e;);return i}(a,s)&&(Y(a.prev,a,s.prev)||Y(a,s.prev,s))||Z(a,s)&&0=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&a=i.x&&i.x>=h&&n!==i.x&&V(or.x||i.x===r.x&&(d=i,Y((p=r).prev,p,d.prev)<0&&Y(d.next,p,p.next)<0)))&&(r=i,f=l)),i=i.next,i!==u;);var p,d;return r}(e,t)){var r=ee(t,e);F(t,t.next),F(r,r.next)}}function W(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function q(e){for(var t=e,r=e;(t.x=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Q(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=_-y,k=Math.floor,S=String.fromCharCode;function P(e){throw RangeError(c[e])}function p(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function d(e,t){var r=e.split("@"),i="";return 1>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function A(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var i=0;for(e=r?k(e/s):e>>1,e+=k(e/t);f*b>>1k((v-d)/a))&&P("overflow"),d+=l*a,!(l<(u=s<=g?y:g+b<=s?b:s-g));s+=_)a>k(v/(h=_-u))&&P("overflow"),a*=h;g=I(d-o,t=f.length+1,0==o),k(d/t)>v-m&&P("overflow"),m+=k(d/t),d%=t,f.splice(d++,0,m)}return C(f)}function g(e){var t,r,i,n,o,a,s,l,u,h,c,f,p,d,m,g=[];for(f=(e=E(e)).length,t=w,o=x,a=r=0;ak((v-r)/(p=i+1))&&P("overflow"),r+=(s-t)*p,t=s,a=0;av&&P("overflow"),c==t){for(l=r,u=_;!(l<(h=u<=o?y:o+b<=u?b:u-o));u+=_)m=l-h,d=_-h,g.push(S(A(h+m%d,0))),l=k(m/d);g.push(S(A(l,0))),o=I(r,p,i==n),r=0,++i}++r,++t}return g.join("")}if(n={version:"1.3.2",ucs2:{decode:E,encode:C},decode:m,encode:g,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return d(e,function(e){return l.test(e)?m(e.slice(4).toLowerCase()):e})}},t&&r)if(O.exports==t)r.exports=n;else for(o in n)n.hasOwnProperty(o)&&(t[o]=n[o]);else e.punycode=n}(D)}),ae={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};ae.isString,ae.isObject,ae.isNull,ae.isNullOrUndefined;var se=function(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var s,l,u=e.length;0",'"',"`"," ","\r","\n","\t"]),xe=["'"].concat(be),we=["%","/","?",";","#"].concat(xe),Te=["/","?","#"],ke=/^[+a-z0-9A-Z_-]{0,63}$/,Se=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Pe={javascript:!0,"javascript:":!0},Ee={javascript:!0,"javascript:":!0},Ce={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ae(e,t,r){if(e&&ae.isObject(e)&&e instanceof ge)return e;var i=new ge;return i.parse(e,t,r),i}ge.prototype.parse=function(e,t,r){if(!ae.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=-1!==i&&i>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function Ke(e){var t=e.toString(16);return"#"+(t="000000".substr(0,6-t.length)+t)}function Qe(e){return"string"==typeof e&&"#"===e[0]&&(e=e.substr(1)),parseInt(e,16)}var $e=function(){for(var e=[],t=[],r=0;r<32;r++)t[e[r]=r]=r;e[G.BLEND_MODES.NORMAL_NPM]=G.BLEND_MODES.NORMAL,e[G.BLEND_MODES.ADD_NPM]=G.BLEND_MODES.ADD,e[G.BLEND_MODES.SCREEN_NPM]=G.BLEND_MODES.SCREEN,t[G.BLEND_MODES.NORMAL]=G.BLEND_MODES.NORMAL_NPM,t[G.BLEND_MODES.ADD]=G.BLEND_MODES.ADD_NPM,t[G.BLEND_MODES.SCREEN]=G.BLEND_MODES.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function et(e,t){return $e[t?1:0][e]}function tt(e,t,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=t,r}function rt(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,i=e>>8&255,n=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((i=i*t+.5|0)<<8)+(n=n*t+.5|0)}function it(e,t,r,i){return(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(i||void 0===i)&&(r[0]*=t,r[1]*=t,r[2]*=t),r[3]=t,r}function nt(e,t){void 0===t&&(t=null);var r=6*e;if((t=t||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+r);for(var i=0,n=0;i>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function lt(e){return!(e&e-1||!e)}function ut(e){var t=(65535>>=t)?1:0)<<3;return t|=r,t|=r=(15<(e>>>=r)?1:0)<<2,(t|=r=(3<(e>>>=r)?1:0)<<1)|(e>>>=r)>>1}function ht(e,t,r){var i,n=e.length;if(!(n<=t||0===r)){var o=n-(r=n=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),i=t-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=e-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=t-(this.y+this.height-this.radius))*i<=n)return!0;if((r=e-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}();A.SORTABLE_CHILDREN=!1;var Vt=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null};Vt.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},Vt.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},Vt.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Xt.EMPTY:((e=e||new Xt(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},Vt.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},Vt.prototype.addQuad=function(e){var t=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=e[0],a=e[1];t=oi?e.maxX:i,this.maxY=e.maxY>n?e.maxY:n},Vt.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,n=e.maxXt.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,n=e.maxXr?this.maxX:r,this.minY=this.minYi?this.maxY:i};var Yt=function(e){function n(){e.call(this),this.tempDisplayObjectParent=null,this.transform=new Ut,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 Vt,this._boundsID=0,this._lastBoundsID=-1,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}e&&(n.__proto__=e);var t={_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((n.prototype=Object.create(e&&e.prototype)).constructor=n).mixin=function(e){for(var t=Object.keys(e),r=0;rthis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e},e.prototype.swapChildren=function(e,t){if(e!==t){var r=this.getChildIndex(e),i=this.getChildIndex(t);this.children[r]=t,this.children[i]=e,this.onChildrenChange(r=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(e);ht(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},e.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},e.prototype.removeChild=function(e){var t=arguments,r=arguments.length;if(1 title : "+e.title+"
tabIndex: "+e.tabIndex},Qt.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},Qt.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2,t.style.borderStyle="none",-1t.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},t.prototype.remove=function(e,t){for(var r=this._head.next;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(e){var t;if(void 0===e&&(e=performance.now()),e>this.lastTime){if((t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var r=e-this._lastFrame|0;if(r]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var Cr=function(h){function r(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){var r=document.createElement("video");r.setAttribute("preload","auto"),r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]),h.crossOrigin(r,e[0].src||e[0],t.crossorigin);for(var i=0;ithis.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",l="X: "+t+" + "+i+" = "+(t+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: "+l+" "+s+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},e.rotate.get=function(){return this._rotate},e.rotate.set=function(e){this._rotate=e,this.valid&&this.updateUvs()},e.width.get=function(){return this.orig.width},e.height.get=function(){return this.orig.height},Object.defineProperties(s.prototype,e),s}(I);function Nr(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}jr.EMPTY=new jr(new Tr),Nr(jr.EMPTY),Nr(jr.EMPTY.baseTexture),jr.WHITE=function(){var e=document.createElement("canvas");e.width=16,e.height=16;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,16,16),new jr(new Tr(new Sr(e)))}(),Nr(jr.WHITE),Nr(jr.WHITE.baseTexture);var Br=function(s){function t(e,t){var r=null;if(!(e instanceof zr)){var i=arguments[1],n=arguments[2],o=arguments[3],a=arguments[4];console.warn("Please use RenderTexture.create("+i+", "+n+") instead of the ctor directly."),r=arguments[0],t=null,e=new zr({width:i,height:n,scaleMode:o,resolution:a})}s.call(this,e,t),this.legacyRenderer=r,this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.resize=function(e,t,r){void 0===r&&(r=!0),e=Math.ceil(e),t=Math.ceil(t),this.valid=0=G.ENV.WEBGL2&&(r=e.getContext("webgl2",t)),r)this.webGLVersion=2;else if(this.webGLVersion=1,!(r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),r},e.prototype.getExtensions=function(){var e=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBKIT_WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:e.getExtension("EXT_color_buffer_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear")})},e.prototype.handleContextLost=function(e){e.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.run(this.gl)},e.prototype.destroy=function(){var e=this.renderer.view;e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(e){e.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly")},Object.defineProperties(e.prototype,r),e}(Or),si=function(t){function e(e){t.call(this,e),this.managedFramebuffers=[],this.unknownFramebuffer=new Dr(10,10)}t&&(e.__proto__=t);var r={size:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).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 Xt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;A.PREFER_ENV===G.ENV.WEBGL_LEGACY&&(r=t=null),t?e.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),r||(this.writeDepthTexture=!1)}},e.prototype.bind=function(e,t){var r=this.gl;if(e){var i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat!==e.dirtyFormat?(i.dirtyFormat=e.dirtyFormat,this.updateFramebuffer(e)):i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var n=0;n=i.data.byteLength)t.bufferSubData(o,0,i.data);else{var a=i.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,t.bufferData(o,i.data,a)}}}},e.prototype.checkCompatibility=function(e,t){var r=e.attributes,i=t.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},e.prototype.getSignature=function(e,t){var r=e.attributes,i=t.attributeData,n=["g",e.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},e.prototype.initGeometryVao=function(e,t){this.checkCompatibility(e,t);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(e,t),o=e.glVertexArrayObjects[this.CONTEXT_UID],a=o[n];if(a)return o[t.id]=a;var s=e.buffers,l=e.attributes,u={},h={};for(var c in s)u[c]=0,h[c]=0;for(var f in l)!l[f].size&&t.attributeData[f]?l[f].size=t.attributeData[f].size:l[f].size||console.warn("PIXI Geometry attribute '"+f+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[l[f].buffer]+=l[f].size*ui[l[f].type];for(var p in l){var d=l[p],m=d.size;void 0===d.stride&&(u[d.buffer]===m*ui[d.type]?d.stride=0:d.stride=u[d.buffer]),void 0===d.start&&(d.start=h[d.buffer],h[d.buffer]+=m*ui[d.type])}a=r.createVertexArray(),r.bindVertexArray(a);for(var g=0;g=G.ENV.WEBGL2&&(e=t.getContext("webgl2",{})),e||((e=t.getContext("webgl",{})||t.getContext("experimental-webgl",{}))?e.getExtension("WEBGL_draw_buffers"):e=null),_i=e}return _i}function bi(e,t,r){if("precision"===e.substring(0,9))return r!==G.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e;var i=t;return t===G.PRECISION.HIGH&&r!==G.PRECISION.HIGH&&(i=G.PRECISION.MEDIUM),"precision "+i+" float;\n"+e}var xi={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};var wi=null,Ti={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 ki(e,t){if(!wi){var r=Object.keys(Ti);wi={};for(var i=0;it.name?1:-1});for(var h=0;h>=1,r++;this.stateId=e.data}for(var i=0;ithis.checkCountMax&&(this.checkCount=0,this.run())))},e.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),r=!(t[i]=null))}if(r){for(var o=0,a=0;athis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},g.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=g._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++Tr._globalBatch,s=0,l=r[0],u=0;i.copyBoundTextures(n,t);for(var h=0;h=t&&(i.boundArray(l,n,a,t),this.buildDrawCalls(l,u,h),u=h,l=r[++s],++a),c._batchEnabled=a,c.touched=o,l.elements[l.count++]=c)}0>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-(e.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(var a=0;a=a.length&&a.push(this._generateOneMoreBuffer(e));var d=a[f];d.uploadDynamic(t,c,p);var m=e._bufferUpdateIDs[f]||0;(h=h||d._updateIDthis.maxSegments&&(r=this.maxSegments),r}},so=function(){this.reset()};so.prototype.clone=function(){var e=new so;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},so.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=jr.WHITE,this.matrix=null,this.visible=!1},so.prototype.destroy=function(){this.texture=null,this.matrix=null};var lo={build:function(e){e.points=e.shape.points.slice()},triangulate:function(e,t){var r=e.points,i=e.holes,n=t.points,o=t.indices;if(6<=r.length){for(var a=[],s=0;s>16)+(65280&t)+((255&t)<<16),r);0>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,e.shader.bind(t),e.geometry.bind(r,t),e.state.set(this.state);for(var s=0,l=a.length;s>16)+(65280&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){if(this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID;for(var e=this.transform.worldTransform,t=e.a,r=e.b,i=e.c,n=e.d,o=e.tx,a=e.ty,s=this.geometry.points,l=this.vertexData,u=0,h=0;h=i&&Do.x=n&&Do.y>16)+(65280&e)+((255&e)<<16)},e.texture.get=function(){return this._texture},e.texture.set=function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||jr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},Object.defineProperties(i.prototype,e),i}(Jt),Fo={LINEAR_VERTICAL:0,LINEAR_HORIZONTAL:1},Lo={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Fo.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},jo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],No=function(e){this.styleID=0,this.reset(),Ho(this,e,e)},Bo={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 Uo(e){return"number"==typeof e?Ke(e):("string"==typeof e&&0===e.indexOf("0x")&&(e=e.replace("0x","#")),e)}function Xo(e){if(Array.isArray(e)){for(var t=0;t=i&&ca.x=n&&ca.ys&&(ht(i,1+f-++d,1+g-f),g=f,f=-1,n.push(p),h=Math.max(h,p),c++,r.x=0,r.y+=e.lineHeight,l=null))}else n.push(u),h=Math.max(h,u),++c,++d,r.x=0,r.y+=e.lineHeight,l=null}var b=o.charAt(o.length-1);"\r"!==b&&"\n"!==b&&(/(?:\s)/.test(b)&&(u=p),n.push(u),h=Math.max(h,u));for(var x=[],w=0;w<=c;w++){var T=0;"right"===this._font.align?T=h-n[w]:"center"===this._font.align&&(T=(h-n[w])/2),x.push(T)}for(var k=i.length,S=this.tint,P=0;P 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",e),this.alpha=1}t&&(e.__proto__=t);var r={matrix:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._loadMatrix=function(e,t){void 0===t&&(t=!1);var r=e;t&&(this._multiply(r,this.uniforms.m,e),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(e,t,r){return e[0]=t[0]*r[0]+t[1]*r[5]+t[2]*r[10]+t[3]*r[15],e[1]=t[0]*r[1]+t[1]*r[6]+t[2]*r[11]+t[3]*r[16],e[2]=t[0]*r[2]+t[1]*r[7]+t[2]*r[12]+t[3]*r[17],e[3]=t[0]*r[3]+t[1]*r[8]+t[2]*r[13]+t[3]*r[18],e[4]=t[0]*r[4]+t[1]*r[9]+t[2]*r[14]+t[3]*r[19]+t[4],e[5]=t[5]*r[0]+t[6]*r[5]+t[7]*r[10]+t[8]*r[15],e[6]=t[5]*r[1]+t[6]*r[6]+t[7]*r[11]+t[8]*r[16],e[7]=t[5]*r[2]+t[6]*r[7]+t[7]*r[12]+t[8]*r[17],e[8]=t[5]*r[3]+t[6]*r[8]+t[7]*r[13]+t[8]*r[18],e[9]=t[5]*r[4]+t[6]*r[9]+t[7]*r[14]+t[8]*r[19]+t[9],e[10]=t[10]*r[0]+t[11]*r[5]+t[12]*r[10]+t[13]*r[15],e[11]=t[10]*r[1]+t[11]*r[6]+t[12]*r[11]+t[13]*r[16],e[12]=t[10]*r[2]+t[11]*r[7]+t[12]*r[12]+t[13]*r[17],e[13]=t[10]*r[3]+t[11]*r[8]+t[12]*r[13]+t[13]*r[18],e[14]=t[10]*r[4]+t[11]*r[9]+t[12]*r[14]+t[13]*r[19]+t[14],e[15]=t[15]*r[0]+t[16]*r[5]+t[17]*r[10]+t[18]*r[15],e[16]=t[15]*r[1]+t[16]*r[6]+t[17]*r[11]+t[18]*r[16],e[17]=t[15]*r[2]+t[16]*r[7]+t[17]*r[12]+t[18]*r[17],e[18]=t[15]*r[3]+t[16]*r[8]+t[17]*r[13]+t[18]*r[18],e[19]=t[15]*r[4]+t[16]*r[9]+t[17]*r[14]+t[18]*r[19]+t[19],e},e.prototype._colorMatrix=function(e){var t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t},e.prototype.brightness=function(e,t){var r=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.greyscale=function(e,t){var r=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.blackAndWhite=function(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)},e.prototype.hue=function(e,t){e=(e||0)/180*Math.PI;var r=Math.cos(e),i=Math.sin(e),n=(0,Math.sqrt)(1/3),o=[r+1/3*(1-r),1/3*(1-r)-n*i,1/3*(1-r)+n*i,0,0,1/3*(1-r)+n*i,r+1/3*(1-r),1/3*(1-r)-n*i,0,0,1/3*(1-r)-n*i,1/3*(1-r)+n*i,r+1/3*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,t)},e.prototype.contrast=function(e,t){var r=(e||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,t)},e.prototype.saturate=function(e,t){void 0===e&&(e=0);var r=2*e/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,t)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)},e.prototype.sepia=function(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)},e.prototype.technicolor=function(e){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],e)},e.prototype.polaroid=function(e){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],e)},e.prototype.toBGR=function(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)},e.prototype.kodachrome=function(e){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],e)},e.prototype.browni=function(e){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],e)},e.prototype.vintage=function(e){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],e)},e.prototype.colorTone=function(e,t,r,i,n){var o=((r=r||16770432)>>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,l=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,h=(255&i)/255,c=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,l,u,h,t=t||.15,0,o-l,a-u,s-h,0,0];this._loadMatrix(c,n)},e.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.predator=function(e,t){var r=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},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(e){this.uniforms.m=e},r.alpha.get=function(){return this.uniforms.uAlpha},r.alpha.set=function(e){this.uniforms.uAlpha=e},Object.defineProperties(e.prototype,r),e}(Ni);ka.prototype.grayscale=ka.prototype.greyscale;var Sa=function(i){function e(e,t){var r=new Mt;e.renderable=!1,i.call(this,"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","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",{mapSampler:e._texture,filterMatrix:r,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=r,null==t&&(t=20),this.scale=new Et(t,t)}i&&(e.__proto__=i);var t={map:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.filterMatrix=e.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),a=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==a&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),e.applyFilter(this,t,r,i)},t.map.get=function(){return this.uniforms.mapSampler},t.map.set=function(e){this.uniforms.mapSampler=e},Object.defineProperties(e.prototype,t),e}(Ni),Pa=function(e){function t(){e.call(this,"\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",'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')}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(Ni),Ea=function(r){function e(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random()),r.call(this,fn,"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",{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={noise:{configurable:!0},seed:{configurable:!0}};return t.noise.get=function(){return this.uniforms.uNoise},t.noise.set=function(e){this.uniforms.uNoise=e},t.seed.get=function(){return this.uniforms.uSeed},t.seed.set=function(e){this.uniforms.uSeed=e},Object.defineProperties(e.prototype,t),e}(Ni),Ca=new Mt;Yt.prototype._cacheAsBitmap=!1,Yt.prototype._cacheData=!1;var Aa=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(Yt.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new Aa),(t=this._cacheData).originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((t=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea))}}}),Yt.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},Yt.prototype._initCachedDisplayObject=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.alpha;this.alpha=1,e.batch.flush();var r=this.getLocalBounds().clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(A.RESOLUTION);var n=e.renderTexture.current,o=e.renderTexture.sourceFrame,a=e.projection.transform,s=Br.create(r.width,r.height),l="cacheAsBitmap_"+pt();this._cacheData.textureCacheId=l,Tr.addToCache(s.baseTexture,l),jr.addToCache(s,l);var u=Ca;u.tx=-r.x,u.ty=-r.y,this.transform.worldTransform.identity(),this.render=this._cacheData.originalRender,e.render(this,s,!0,u,!0),e.projection.transform=a,e.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 h=new zo(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-r.x/r.width,h.anchor.y=-r.y/r.height,h.alpha=t,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},Yt.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},Yt.prototype._initCachedDisplayObjectCanvas=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.getLocalBounds(),r=this.alpha;this.alpha=1;var i=e.context;t.ceil(A.RESOLUTION);var n=Br.create(t.width,t.height),o="cacheAsBitmap_"+pt();this._cacheData.textureCacheId=o,Tr.addToCache(n.baseTexture,o),jr.addToCache(n,o);var a=Ca;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=t.x,a.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,n,!0,a,!1),e.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 s=new zo(n);s.transform.worldTransform=this.transform.worldTransform,s.anchor.x=-t.x/t.width,s.anchor.y=-t.y/t.height,s.alpha=r,s._bounds=this._bounds,this._cacheData.sprite=s,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=s.containsPoint.bind(s)}},Yt.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._lastBoundsID=this._boundsID},Yt.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds()},Yt.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Tr.removeFromCache(this._cacheData.textureCacheId),jr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Yt.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},Yt.prototype.name=null,Jt.prototype.getChildByName=function(e){for(var t=0;t>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},t.tint.get=function(){return this._tint},e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;it(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},Object.defineProperties(e.prototype,t),e}(zi),Fa=function(a){function e(e,t,r){a.call(this);var i=new Wr(e),n=new Wr(t,!0),o=new Wr(r,!0,!0);this.addAttribute("aVertexPosition",i,2,!1,G.TYPES.FLOAT).addAttribute("aTextureCoord",n,2,!1,G.TYPES.FLOAT).addIndex(o),this._updateId=-1}a&&(e.__proto__=a),(e.prototype=Object.create(a&&a.prototype)).constructor=e;var t={vertexDirtyId:{configurable:!0}};return t.vertexDirtyId.get=function(){return this.buffers[0]._updateID},Object.defineProperties(e.prototype,t),e}(Jr),La=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=100),void 0===r&&(r=10),void 0===i&&(i=10),n.call(this),this.segWidth=r,this.segHeight=i,this.width=e,this.height=t,this.build()}return n&&(e.__proto__=n),((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.build=function(){for(var e=this.segWidth*this.segHeight,t=[],r=[],i=[],n=this.segWidth-1,o=this.segHeight-1,a=this.width/n,s=this.height/o,l=0;le?1:this._width/e,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(t,i)},t.width.get=function(){return this._width},t.width.set=function(e){this._width=e,this._refresh()},t.height.get=function(){return this._height},t.height.set=function(e){this._height=e,this._refresh()},t.leftWidth.get=function(){return this._leftWidth},t.leftWidth.set=function(e){this._leftWidth=e,this._refresh()},t.rightWidth.get=function(){return this._rightWidth},t.rightWidth.set=function(e){this._rightWidth=e,this._refresh()},t.topHeight.get=function(){return this._topHeight},t.topHeight.set=function(e){this._topHeight=e,this._refresh()},t.bottomHeight.get=function(){return this._bottomHeight},t.bottomHeight.set=function(e){this._bottomHeight=e,this._refresh()},e.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var r=1/this._origWidth,i=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},Object.defineProperties(e.prototype,t),e}(Ba),Ha=function(r){function i(e,t){r.call(this,e[0]instanceof jr?e[0]:e[0].texture),this._textures=null,this._durations=null,this.textures=e,this._autoUpdate=!1!==t,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this.playing=!1}r&&(i.__proto__=r);var e={totalFrames:{configurable:!0},textures:{configurable:!0},currentFrame:{configurable:!0}};return((i.prototype=Object.create(r&&r.prototype)).constructor=i).prototype.stop=function(){this.playing&&(this.playing=!1,this._autoUpdate&&rr.shared.remove(this.update,this))},i.prototype.play=function(){this.playing||(this.playing=!0,this._autoUpdate&&rr.shared.add(this.update,this,G.UPDATE_PRIORITY.HIGH))},i.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},i.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},i.prototype.update=function(e){var t=this.animationSpeed*e,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=t/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*e);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+=t;this._currentTime<0&&!this.loop?(this._currentTime=0,this.stop(),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this._currentTime=this._textures.length-1,this.stop(),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(0r&&this.onLoop()),this.updateTexture())},i.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)},i.prototype.destroy=function(e){this.stop(),r.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},i.fromFrames=function(e){for(var t=[],r=0;r 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,i){return i&&i.length?(i.splice||(i=Array.prototype.slice.call(i)),i.splice(0,0,r),e["dynCall_"+t].apply(null,i)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,l,u="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,u?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===u)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=i||r)&&(o++,!r||o!=r););if(r||(r=o),i="",n<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,i){if(!(0>6}else{if(a<=65535){if(i<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(i<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(i<=r+4)break;t[r++]=248|a>>24}else{if(i<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-n}function La(e){for(var t=0,r=0;r"):o=n;e:for(;c>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var i=z[e+2*t>>1];if(0==i)return r;++t,r+=String.fromCharCode(i)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var i=t;r=(r-=2)<2*e.length?r/2:e.length;for(var n=0;n>1]=e.charCodeAt(n),t+=2;return z[t>>1]=0,t-i},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var i=C[e+4*t>>2];if(0==i)return r;++t,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var i=t;r=i+r-4;for(var n=0;n>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-i},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*i+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,i=e.length-1;0<=i;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,i){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var n=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-n,i))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,i){e=P.createNode(e,t,r,i),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,i,n){if(0===i)return 0;var o,a=new Buffer(i);try{o=fs.readSync(e.V,a,0,i,n)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var i=r.name;if(r.parent.id===e.id&&i===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,i){return Zb||((Zb=function(e,t,r,i){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=i}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,i)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,i="/"===t,n=!t;if(i&&Pb)throw new L(J.fa);if(!i&&!n){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}n={type:e,pa:{},Oa:t,lb:[]};var o=e.A(n);(o.A=n).root=o,i?Pb=o:r&&(r.U=n,r.A&&r.A.lb.push(n))}function fc(e,t,r){var i=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var n=ac(i,e);if(n)throw new L(n);if(!i.k.T)throw new L(J.I);return i.k.T(i,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var i=Bb(t),n=ac(r,i);if(n)throw new L(n);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,i,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var i,n,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(n=$b[r]))throw Error("Unknown file open mode: "+r)}else n=r;if(i=64&(r=n)?4095&(void 0===i?438:i)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(n=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,i,0),n=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!n&&(i=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(i=["r","w","rw"][3&r],512&r&&(i+="w"),Yb(o,i)):J.F))throw new L(i);if(512&r){var a;if(!(a="string"==typeof(i=o)?S(i,{la:!0}).g:i).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(i=Yb(a,"w"))throw new L(i);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,i,n,o){if(i<0||n<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===n)n=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,i,n,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,i){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,i))}function tc(e,t,r,i,n,o){if(n=gc(e=t?K("string"==typeof e?e:T(e),t):e,i=rc(i,n)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var l=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),u.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(u)}},u.src=n,ad(function(){s(u)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,i,n){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},n)for(var s in n)a[s]=n[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(i&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,i){function n(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=i)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),i?a.p({Ud:i}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,i){r&&i?(t.ub=r,t.hb=i):(r=t.ub,i=t.hb);var n=r,o=i;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",l,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+l+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var i=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(i=Math.min(e.length-n,i))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(n=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,i,n);default:x("bad ioctl syscall "+i)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),i=X(),n=X(),o=X(),a=X();return assert(0===i),nc(r,n,a),C[o>>2]=r.position,r.na&&0===n&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,i=xc(),n=X();e:{for(var o=X(),a=0,s=0;s>2],C[n+(8*s+4)>>2],void 0);if(l<0){r=-1;break e}a+=l}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var i=e.Int8Array;var n=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var l=e.Uint32Array;var u=e.Float32Array;var h=e.Float64Array;var pe=new i(r);var $=new n(r);var de=new o(r);var me=new a(r);var ge=new s(r);var c=new l(r);var f=new u(r);var ee=new h(r);var p=e.byteLength;var ve=t.STACKTOP|0;var d=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var m=t.ABORT|0;var g=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,k=0,S=0,P=0,E=0.0,C=0,A=0,I=0,O=0.0;var re=0;var M=0;var D=0;var R=0;var z=0;var F=0;var L=0;var j=0;var N=0;var B=0;var U=e.Math.floor;var X=e.Math.abs;var H=e.Math.sqrt;var W=e.Math.pow;var q=e.Math.cos;var G=e.Math.sin;var V=e.Math.tan;var Y=e.Math.acos;var Z=e.Math.asin;var J=e.Math.atan;var K=e.Math.atan2;var Q=e.Math.exp;var ie=e.Math.log;var ne=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var le=t.assert;var ue=t.invoke_iiii;var he=t.invoke_viiiii;var ce=t.invoke_vi;var fe=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var ke=t._pthread_cleanup_pop;var Se=t.___syscall54;var Pe=t.___syscall6;var Ee=t._emscripten_set_main_loop_timing;var Ce=t.__ZSt18uncaught_exceptionv;var Ae=t.___setErrNo;var Ie=t._sbrk;var Oe=t.___cxa_begin_catch;var Me=t._emscripten_memcpy_big;var De=t._sysconf;var Re=t._pthread_getspecific;var ze=t._pthread_self;var Fe=t._pthread_once;var Le=t._pthread_key_create;var je=t.___unlock;var Ne=t._emscripten_set_main_loop;var Be=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var He=t._pthread_cleanup_push;var We=t._time;var qe=t.___syscall140;var Ge=t.___syscall146;var Ve=0.0;function Ye(e){if(p(e)&16777215||p(e)<=16777215||p(e)>2147483648)return false;pe=new i(e);$=new n(e);de=new o(e);me=new a(e);ge=new s(e);c=new l(e);f=new u(e);ee=new h(e);r=e;return true}function Ze(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Je(){return ve|0}function Ke(e){e=e|0;ve=e}function Qe(e,t){e=e|0;t=t|0;ve=e;d=t}function $e(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0]}function tt(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0];pe[te+4>>0]=pe[e+4>>0];pe[te+5>>0]=pe[e+5>>0];pe[te+6>>0]=pe[e+6>>0];pe[te+7>>0]=pe[e+7>>0]}function rt(e){e=e|0;re=e}function it(){return re|0}function nt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ve;ve=ve+608|0;f=m+88|0;c=m+72|0;l=m+64|0;s=m+48|0;a=m+24|0;o=m;h=m+96|0;p=m+92|0;u=e+4|0;d=e+8|0;if((de[u>>2]|0)>>>0>(de[d>>2]|0)>>>0){de[o>>2]=1154;de[o+4>>2]=2120;de[o+8>>2]=1133;br(h,1100,o)|0;yr(h,m+16|0)|0}if((2147418112/(i>>>0)|0)>>>0<=t>>>0){de[a>>2]=1154;de[a+4>>2]=2121;de[a+8>>2]=1169;br(h,1100,a)|0;yr(h,m+40|0)|0}a=de[d>>2]|0;if(a>>>0>=t>>>0){d=1;ve=m;return d|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){de[s>>2]=1154;de[s+4>>2]=2130;de[s+8>>2]=1217;br(h,1100,s)|0;yr(h,l)|0}r=_e(t,i)|0;do{if(!n){o=ot(de[e>>2]|0,r,p,1)|0;if(!o){d=0;ve=m;return d|0}else{de[e>>2]=o;break}}else{a=at(r,p)|0;if(!a){d=0;ve=m;return d|0}Ii[n&0](a,de[e>>2]|0,de[u>>2]|0);o=de[e>>2]|0;do{if(o)if(!(o&7)){Di[de[104>>2]&1](o,0,0,1,de[27]|0)|0;break}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;break}}while(0);de[e>>2]=a}}while(0);o=de[p>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(i>>>0)|0;de[d>>2]=t;d=1;ve=m;return d|0}function ot(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=ve;ve=ve+592|0;l=u+48|0;o=u+24|0;n=u;s=u+72|0;a=u+68|0;if(e&7){de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1494;br(s,1100,n)|0;yr(s,u+16|0)|0;l=0;ve=u;return l|0}if(t>>>0>2147418112){de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1387;br(s,1100,o)|0;yr(s,u+40|0)|0;l=0;ve=u;return l|0}de[a>>2]=t;i=Di[de[104>>2]&1](e,t,a,i,de[27]|0)|0;if(r)de[r>>2]=de[a>>2];if(!(i&7)){l=i;ve=u;return l|0}de[l>>2]=1154;de[l+4>>2]=2551;de[l+8>>2]=1440;br(s,1100,l)|0;yr(s,u+64|0)|0;l=i;ve=u;return l|0}function at(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+592|0;a=l+48|0;s=l+24|0;r=l;o=l+72|0;n=l+68|0;i=e+3&-4;i=(i|0)!=0?i:4;if(i>>>0>2147418112){de[r>>2]=1154;de[r+4>>2]=2499;de[r+8>>2]=1387;br(o,1100,r)|0;yr(o,l+16|0)|0;s=0;ve=l;return s|0}de[n>>2]=i;r=Di[de[104>>2]&1](0,i,n,1,de[27]|0)|0;e=de[n>>2]|0;if(t)de[t>>2]=e;if((r|0)==0|e>>>0
>>0){de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1413;br(o,1100,s)|0;yr(o,l+40|0)|0;s=0;ve=l;return s|0}if(!(r&7)){s=r;ve=l;return s|0}de[a>>2]=1154;de[a+4>>2]=2526;de[a+8>>2]=1440;br(o,1100,a)|0;yr(o,l+64|0)|0;s=r;ve=l;return s|0}function st(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0;j=ve;ve=ve+960|0;z=j+232|0;R=j+216|0;D=j+208|0;M=j+192|0;O=j+184|0;I=j+168|0;A=j+160|0;C=j+144|0;S=j+136|0;k=j+120|0;T=j+112|0;w=j+96|0;y=j+88|0;_=j+72|0;v=j+64|0;g=j+48|0;c=j+40|0;p=j+24|0;f=j+16|0;h=j;E=j+440|0;F=j+376|0;L=j+304|0;m=j+236|0;if((t|0)==0|i>>>0>11){e=0;ve=j;return e|0}de[e>>2]=t;n=L;o=n+68|0;do{de[n>>2]=0;n=n+4|0}while((n|0)<(o|0));o=0;do{n=pe[r+o>>0]|0;if(n<<24>>24){P=L+((n&255)<<2)|0;de[P>>2]=(de[P>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;u=1;a=0;s=-1;l=0;while(1){n=de[L+(u<<2)>>2]|0;if(!n)de[e+28+(u+-1<<2)>>2]=0;else{P=u+-1|0;de[F+(P<<2)>>2]=o;o=n+o|0;x=16-u|0;de[e+28+(P<<2)>>2]=(o+-1<>2]=l;de[m+(u<<2)>>2]=l;a=a>>>0>u>>>0?a:u;s=s>>>0>>0?s:u;l=n+l|0}u=u+1|0;if((u|0)==17){P=a;break}else o=o<<1}de[e+4>>2]=l;o=e+172|0;do{if(l>>>0>(de[o>>2]|0)>>>0){de[o>>2]=l;if(l){n=l+-1|0;if(n&l)d=14}else{n=-1;d=14}if((d|0)==14){x=n>>>16|n;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;de[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;n=de[a>>2]|0;do{if(n){x=de[n+-4>>2]|0;n=n+-8|0;if(!((x|0)!=0?(x|0)==(~de[n>>2]|0):0)){de[h>>2]=1154;de[h+4>>2]=644;de[h+8>>2]=1863;br(E,1100,h)|0;yr(E,f)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(E,1100,p)|0;yr(E,c)|0;break}}}while(0);o=de[o>>2]|0;o=(o|0)!=0?o:1;n=at((o<<1)+8|0,0)|0;if(!n){de[a>>2]=0;n=0;break}else{de[n+4>>2]=o;de[n>>2]=~o;de[a>>2]=n+8;d=25;break}}else d=25}while(0);e:do{if((d|0)==25){x=e+24|0;pe[x>>0]=s;pe[e+25>>0]=P;o=e+176|0;a=0;do{b=pe[r+a>>0]|0;n=b&255;if(b<<24>>24){if(!(de[L+(n<<2)>>2]|0)){de[g>>2]=1154;de[g+4>>2]=2273;de[g+8>>2]=1261;br(E,1100,g)|0;yr(E,v)|0}b=m+(n<<2)|0;n=de[b>>2]|0;de[b>>2]=n+1;if(n>>>0>=l>>>0){de[_>>2]=1154;de[_+4>>2]=2277;de[_+8>>2]=1274;br(E,1100,_)|0;yr(E,y)|0}$[(de[o>>2]|0)+(n<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));n=pe[x>>0]|0;y=(n&255)>>>0>>0?i:0;b=e+8|0;de[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(de[n>>2]|0)>>>0){de[n>>2]=v;a=e+168|0;n=de[a>>2]|0;do{if(n){g=de[n+-4>>2]|0;n=n+-8|0;if(!((g|0)!=0?(g|0)==(~de[n>>2]|0):0)){de[w>>2]=1154;de[w+4>>2]=644;de[w+8>>2]=1863;br(E,1100,w)|0;yr(E,T)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[k>>2]=1154;de[k+4>>2]=2499;de[k+8>>2]=1516;br(E,1100,k)|0;yr(E,S)|0;break}}}while(0);n=v<<2;o=at(n+8|0,0)|0;if(!o){de[a>>2]=0;n=0;break e}else{S=o+8|0;de[o+4>>2]=v;de[o>>2]=~v;de[a>>2]=S;o=S;break}}else{o=e+168|0;n=v<<2;a=o;o=de[o>>2]|0}}while(0);Yr(o|0,-1,n|0)|0;d=e+176|0;g=1;do{if(de[L+(g<<2)>>2]|0){t=y-g|0;m=1<>2]|0;if(o>>>0>=16){de[C>>2]=1154;de[C+4>>2]=1953;de[C+8>>2]=1737;br(E,1100,C)|0;yr(E,A)|0}n=de[e+28+(o<<2)>>2]|0;if(!n)p=-1;else p=(n+-1|0)>>>(16-g|0);if(s>>>0<=p>>>0){c=(de[e+96+(o<<2)>>2]|0)-s|0;f=g<<16;do{n=ge[(de[d>>2]|0)+(c+s<<1)>>1]|0;if((me[r+n>>0]|0|0)!=(g|0)){de[I>>2]=1154;de[I+4>>2]=2319;de[I+8>>2]=1303;br(E,1100,I)|0;yr(E,O)|0}h=s<>>0>=v>>>0){de[M>>2]=1154;de[M+4>>2]=2325;de[M+8>>2]=1337;br(E,1100,M)|0;yr(E,D)|0}n=de[a>>2]|0;if((de[n+(l<<2)>>2]|0)!=-1){de[R>>2]=1154;de[R+4>>2]=2327;de[R+8>>2]=1360;br(E,1100,R)|0;yr(E,z)|0;n=de[a>>2]|0}de[n+(l<<2)>>2]=o;u=u+1|0}while(u>>>0>>0);s=s+1|0}while(s>>>0<=p>>>0)}}g=g+1|0}while(y>>>0>=g>>>0);n=pe[x>>0]|0}o=e+96|0;de[o>>2]=(de[o>>2]|0)-(de[F>>2]|0);o=e+100|0;de[o>>2]=(de[o>>2]|0)-(de[F+4>>2]|0);o=e+104|0;de[o>>2]=(de[o>>2]|0)-(de[F+8>>2]|0);o=e+108|0;de[o>>2]=(de[o>>2]|0)-(de[F+12>>2]|0);o=e+112|0;de[o>>2]=(de[o>>2]|0)-(de[F+16>>2]|0);o=e+116|0;de[o>>2]=(de[o>>2]|0)-(de[F+20>>2]|0);o=e+120|0;de[o>>2]=(de[o>>2]|0)-(de[F+24>>2]|0);o=e+124|0;de[o>>2]=(de[o>>2]|0)-(de[F+28>>2]|0);o=e+128|0;de[o>>2]=(de[o>>2]|0)-(de[F+32>>2]|0);o=e+132|0;de[o>>2]=(de[o>>2]|0)-(de[F+36>>2]|0);o=e+136|0;de[o>>2]=(de[o>>2]|0)-(de[F+40>>2]|0);o=e+140|0;de[o>>2]=(de[o>>2]|0)-(de[F+44>>2]|0);o=e+144|0;de[o>>2]=(de[o>>2]|0)-(de[F+48>>2]|0);o=e+148|0;de[o>>2]=(de[o>>2]|0)-(de[F+52>>2]|0);o=e+152|0;de[o>>2]=(de[o>>2]|0)-(de[F+56>>2]|0);o=e+156|0;de[o>>2]=(de[o>>2]|0)-(de[F+60>>2]|0);o=e+16|0;de[o>>2]=0;a=e+20|0;de[a>>2]=n&255;t:do{if(_){while(1){if(!i)break t;n=i+-1|0;if(!(de[L+(i<<2)>>2]|0))i=n;else break}de[o>>2]=de[e+28+(n<<2)>>2];n=y+1|0;de[a>>2]=n;if(n>>>0<=P>>>0){while(1){if(de[L+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>P>>>0)break t}de[a>>2]=n}}}while(0);de[e+92>>2]=-1;de[e+160>>2]=1048575;de[e+12>>2]=32-(de[b>>2]|0);n=1}}while(0);e=n;ve=j;return e|0}function lt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0;if(!e){n=Br(t)|0;if(!r){r=n;return r|0}if(!n)o=0;else o=Hr(n)|0;de[r>>2]=o;r=n;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}de[r>>2]=0;r=0;return r|0}n=Xr(e,t)|0;o=(n|0)!=0;if(o|i^1)o=o?n:e;else{n=Xr(e,t)|0;o=(n|0)==0?e:n}if(!r){r=n;return r|0}t=Hr(o)|0;de[r>>2]=t;r=n;return r|0}function ut(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((de[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}de[r+4>>2]=(me[e+12>>0]|0)<<8|(me[e+13>>0]|0);de[r+8>>2]=(me[e+14>>0]|0)<<8|(me[e+15>>0]|0);de[r+12>>2]=me[e+16>>0];de[r+16>>2]=me[e+17>>0];t=e+18|0;i=r+32|0;de[i>>2]=me[t>>0];de[i+4>>2]=0;t=pe[t>>0]|0;de[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;de[r+24>>2]=(me[e+26>>0]|0)<<16|(me[e+25>>0]|0)<<24|(me[e+27>>0]|0)<<8|(me[e+28>>0]|0);de[r+28>>2]=(me[e+30>>0]|0)<<16|(me[e+29>>0]|0)<<24|(me[e+31>>0]|0)<<8|(me[e+32>>0]|0);r=1;return r|0}function ht(e){e=e|0;Oe(e|0)|0;Ut()}function ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0;o=ve;ve=ve+544|0;n=o;i=o+24|0;t=de[e+20>>2]|0;if(t)ft(t);t=e+4|0;r=de[t>>2]|0;if(!r){n=e+16|0;pe[n>>0]=0;ve=o;return}if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;br(i,1100,n)|0;yr(i,o+16|0)|0}de[t>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;n=e+16|0;pe[n>>0]=0;ve=o;return}function ft(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=ve;ve=ve+640|0;f=p+112|0;c=p+96|0;h=p+88|0;u=p+72|0;l=p+64|0;s=p+48|0;i=p+40|0;o=p+24|0;n=p+16|0;r=p;a=p+120|0;if(!e){ve=p;return}t=de[e+168>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[r>>2]=1154;de[r+4>>2]=644;de[r+8>>2]=1863;br(a,1100,r)|0;yr(a,n)|0}if(!(t&7)){Di[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1516;br(a,1100,o)|0;yr(a,i)|0;break}}}while(0);t=de[e+176>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[s>>2]=1154;de[s+4>>2]=644;de[s+8>>2]=1863;br(a,1100,s)|0;yr(a,l)|0}if(!(t&7)){Di[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[u>>2]=1154;de[u+4>>2]=2499;de[u+8>>2]=1516;br(a,1100,u)|0;yr(a,h)|0;break}}}while(0);if(!(e&7)){Di[de[104>>2]&1](e,0,0,1,de[27]|0)|0;ve=p;return}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(a,1100,c)|0;yr(a,f)|0;ve=p;return}}function pt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+560|0;a=h+40|0;s=h+24|0;t=h;o=h+48|0;n=e+8|0;r=de[n>>2]|0;if((r+-1|0)>>>0>=8192){de[t>>2]=1154;de[t+4>>2]=2997;de[t+8>>2]=1541;br(o,1100,t)|0;yr(o,h+16|0)|0}de[e>>2]=r;i=e+20|0;t=de[i>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{u=t+164|0;de[u>>2]=0;de[u+4>>2]=0;de[u+8>>2]=0;de[u+12>>2]=0}de[i>>2]=t;u=t;l=de[e>>2]|0}else{u=t;l=r}if(!(de[n>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=de[e>>2]|0}else o=l;n=de[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;u=st(u,l,n,e)|0;ve=h;return u|0}while(1){i=t+1|0;if(r>>>0>3){r=r>>>1;t=i}else{r=i;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;u=st(u,l,n,e)|0;ve=h;return u|0}function dt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0;z=ve;ve=ve+800|0;I=z+256|0;A=z+240|0;C=z+232|0;E=z+216|0;P=z+208|0;S=z+192|0;k=z+184|0;T=z+168|0;w=z+160|0;x=z+144|0;b=z+136|0;y=z+120|0;_=z+112|0;v=z+96|0;g=z+88|0;m=z+72|0;c=z+64|0;h=z+48|0;s=z+40|0;l=z+24|0;o=z+16|0;n=z;D=z+288|0;R=z+264|0;O=mt(e,14)|0;if(!O){de[t>>2]=0;r=t+4|0;i=de[r>>2]|0;if(i){if(!(i&7))Di[de[104>>2]&1](i,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;br(D,1100,n)|0;yr(D,o)|0}de[r>>2]=0;de[t+8>>2]=0;de[t+12>>2]=0}pe[t+16>>0]=0;r=t+20|0;i=de[r>>2]|0;if(!i){t=1;ve=z;return t|0}ft(i);de[r>>2]=0;t=1;ve=z;return t|0}p=t+4|0;d=t+8|0;r=de[d>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((de[t+12>>2]|0)>>>0>>0){if(nt(p,O,(r+1|0)==(O|0),1,0)|0){r=de[d>>2]|0;break}pe[t+16>>0]=1;t=0;ve=z;return t|0}}while(0);Yr((de[p>>2]|0)+r|0,0,O-r|0)|0}de[d>>2]=O}Yr(de[p>>2]|0,0,O|0)|0;f=e+20|0;r=de[f>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;n=e+16|0;do{i=de[o>>2]|0;if((i|0)==(de[a>>2]|0))i=0;else{de[o>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;br(D,1100,l)|0;yr(D,s)|0;r=de[f>>2]|0}i=i<<32-r|de[n>>2];de[n>>2]=i}while((r|0)<5)}else{i=e+16|0;n=i;i=de[i>>2]|0}u=i>>>27;de[n>>2]=i<<5;de[f>>2]=r+-5;if((u+-1|0)>>>0>20){t=0;ve=z;return t|0}de[R+20>>2]=0;de[R>>2]=0;de[R+4>>2]=0;de[R+8>>2]=0;de[R+12>>2]=0;pe[R+16>>0]=0;r=R+4|0;i=R+8|0;e:do{if(nt(r,21,0,1,0)|0){s=de[i>>2]|0;l=de[r>>2]|0;Yr(l+s|0,0,21-s|0)|0;de[i>>2]=21;if(u){n=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=de[f>>2]|0;if((r|0)<3)do{i=de[n>>2]|0;if((i|0)==(de[o>>2]|0))i=0;else{de[n>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[h>>2]=1154;de[h+4>>2]=3199;de[h+8>>2]=1650;br(D,1100,h)|0;yr(D,c)|0;r=de[f>>2]|0}i=i<<32-r|de[a>>2];de[a>>2]=i}while((r|0)<3);else i=de[a>>2]|0;de[a>>2]=i<<3;de[f>>2]=r+-3;pe[l+(me[1611+s>>0]|0)>>0]=i>>>29;s=s+1|0}while((s|0)!=(u|0))}if(pt(R)|0){s=e+4|0;l=e+8|0;u=e+16|0;i=0;t:while(1){a=O-i|0;r=gt(e,R)|0;r:do{if(r>>>0<17){if((de[d>>2]|0)>>>0<=i>>>0){de[m>>2]=1154;de[m+4>>2]=903;de[m+8>>2]=1781;br(D,1100,m)|0;yr(D,g)|0}pe[(de[p>>2]|0)+i>>0]=r;r=i+1|0}else switch(r|0){case 17:{r=de[f>>2]|0;if((r|0)<3)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[v>>2]=1154;de[v+4>>2]=3199;de[v+8>>2]=1650;br(D,1100,v)|0;yr(D,_)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<3);else n=de[u>>2]|0;de[u>>2]=n<<3;de[f>>2]=r+-3;r=(n>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}case 18:{r=de[f>>2]|0;if((r|0)<7)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[y>>2]=1154;de[y+4>>2]=3199;de[y+8>>2]=1650;br(D,1100,y)|0;yr(D,b)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<7);else n=de[u>>2]|0;de[u>>2]=n<<7;de[f>>2]=r+-7;r=(n>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}default:{if((r+-19|0)>>>0>=2){M=90;break t}o=de[f>>2]|0;if((r|0)==19){if((o|0)<2){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[x>>2]=1154;de[x+4>>2]=3199;de[x+8>>2]=1650;br(D,1100,x)|0;yr(D,w)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<2)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<2;de[f>>2]=r+-2;o=(n>>>30)+3|0}else{if((o|0)<6){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[T>>2]=1154;de[T+4>>2]=3199;de[T+8>>2]=1650;br(D,1100,T)|0;yr(D,k)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<6)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<6;de[f>>2]=r+-6;o=(n>>>26)+7|0}if((i|0)==0|o>>>0>a>>>0){r=0;break e}r=i+-1|0;if((de[d>>2]|0)>>>0<=r>>>0){de[S>>2]=1154;de[S+4>>2]=903;de[S+8>>2]=1781;br(D,1100,S)|0;yr(D,P)|0}n=pe[(de[p>>2]|0)+r>>0]|0;if(!(n<<24>>24)){r=0;break e}r=o+i|0;if(i>>>0>=r>>>0){r=i;break r}do{if((de[d>>2]|0)>>>0<=i>>>0){de[E>>2]=1154;de[E+4>>2]=903;de[E+8>>2]=1781;br(D,1100,E)|0;yr(D,C)|0}pe[(de[p>>2]|0)+i>>0]=n;i=i+1|0}while((i|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)i=r;else break}if((M|0)==90){de[A>>2]=1154;de[A+4>>2]=3140;de[A+8>>2]=1632;br(D,1100,A)|0;yr(D,I)|0;r=0;break}if((O|0)==(r|0))r=pt(t)|0;else r=0}else r=0}else{pe[R+16>>0]=1;r=0}}while(0);ct(R);t=r;ve=z;return t|0}function mt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+544|0;s=h+16|0;a=h;o=h+24|0;if(!t){u=0;ve=h;return u|0}if(t>>>0<=16){u=vt(e,t)|0;ve=h;return u|0}l=vt(e,t+-16|0)|0;u=e+20|0;t=de[u>>2]|0;if((t|0)<16){i=e+4|0;n=e+8|0;r=e+16|0;do{e=de[i>>2]|0;if((e|0)==(de[n>>2]|0))e=0;else{de[i>>2]=e+1;e=me[e>>0]|0}t=t+8|0;de[u>>2]=t;if((t|0)>=33){de[a>>2]=1154;de[a+4>>2]=3199;de[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=de[u>>2]|0}e=e<<32-t|de[r>>2];de[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=de[e>>2]|0}de[r>>2]=e<<16;de[u>>2]=t+-16;u=e>>>16|l<<16;ve=h;return u|0}function gt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;m=y+88|0;d=y+72|0;f=y+64|0;c=y+48|0;h=y+40|0;p=y+24|0;u=y+16|0;l=y;v=y+96|0;g=de[t+20>>2]|0;_=e+20|0;s=de[_>>2]|0;do{if((s|0)<24){a=e+4|0;i=de[a>>2]|0;n=de[e+8>>2]|0;r=i>>>0>>0;if((s|0)>=16){if(r){de[a>>2]=i+1;r=me[i>>0]|0}else r=0;de[_>>2]=s+8;a=e+16|0;o=r<<24-s|de[a>>2];de[a>>2]=o;break}if(r){o=(me[i>>0]|0)<<8;r=i+1|0}else{o=0;r=i}if(r>>>0>>0){i=me[r>>0]|0;r=r+1|0}else i=0;de[a>>2]=r;de[_>>2]=s+16;a=e+16|0;o=(i|o)<<16-s|de[a>>2];de[a>>2]=o}else{o=e+16|0;a=o;o=de[o>>2]|0}}while(0);n=(o>>>16)+1|0;do{if(n>>>0<=(de[g+16>>2]|0)>>>0){i=de[(de[g+168>>2]|0)+(o>>>(32-(de[g+8>>2]|0)|0)<<2)>>2]|0;if((i|0)==-1){de[l>>2]=1154;de[l+4>>2]=3244;de[l+8>>2]=1677;br(v,1100,l)|0;yr(v,u)|0}r=i&65535;i=i>>>16;if((de[t+8>>2]|0)>>>0<=r>>>0){de[p>>2]=1154;de[p+4>>2]=902;de[p+8>>2]=1781;br(v,1100,p)|0;yr(v,h)|0}if((me[(de[t+4>>2]|0)+r>>0]|0|0)!=(i|0)){de[c>>2]=1154;de[c+4>>2]=3248;de[c+8>>2]=1694;br(v,1100,c)|0;yr(v,f)|0}}else{i=de[g+20>>2]|0;while(1){r=i+-1|0;if(n>>>0>(de[g+28+(r<<2)>>2]|0)>>>0)i=i+1|0;else break}r=(o>>>(32-i|0))+(de[g+96+(r<<2)>>2]|0)|0;if(r>>>0<(de[t>>2]|0)>>>0){r=ge[(de[g+176>>2]|0)+(r<<1)>>1]|0;break}de[d>>2]=1154;de[d+4>>2]=3266;de[d+8>>2]=1632;br(v,1100,d)|0;yr(v,m)|0;_=0;ve=y;return _|0}}while(0);de[a>>2]=de[a>>2]<>2]=(de[_>>2]|0)-i;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+560|0;s=h+40|0;l=h+24|0;r=h;a=h+48|0;if(t>>>0>=33){de[r>>2]=1154;de[r+4>>2]=3190;de[r+8>>2]=1634;br(a,1100,r)|0;yr(a,h+16|0)|0}u=e+20|0;r=de[u>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=de[o>>2]|0;s=r;l=32-t|0;l=o>>>l;o=o<>2]=o;t=s-t|0;de[u>>2]=t;ve=h;return l|0}n=e+4|0;o=e+8|0;i=e+16|0;do{e=de[n>>2]|0;if((e|0)==(de[o>>2]|0))e=0;else{de[n>>2]=e+1;e=me[e>>0]|0}r=r+8|0;de[u>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;br(a,1100,l)|0;yr(a,s)|0;r=de[u>>2]|0}e=e<<32-r|de[i>>2];de[i>>2]=e}while((r|0)<(t|0));l=32-t|0;l=e>>>l;s=e<>2]=s;t=r-t|0;de[u>>2]=t;ve=h;return l|0}function _t(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0;d=ve;ve=ve+544|0;f=d+16|0;c=d;h=d+24|0;if((e|0)==0|t>>>0<62){p=0;ve=d;return p|0}u=at(300,0)|0;if(!u){p=0;ve=d;return p|0}de[u>>2]=519686845;r=u+4|0;de[r>>2]=0;i=u+8|0;de[i>>2]=0;l=u+88|0;n=u+136|0;o=u+160|0;a=l;s=a+44|0;do{de[a>>2]=0;a=a+4|0}while((a|0)<(s|0));pe[l+44>>0]=0;m=u+184|0;a=u+208|0;s=u+232|0;g=u+252|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+268|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+284|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;de[n>>2]=0;de[n+4>>2]=0;de[n+8>>2]=0;de[n+12>>2]=0;de[n+16>>2]=0;pe[n+20>>0]=0;de[o>>2]=0;de[o+4>>2]=0;de[o+8>>2]=0;de[o+12>>2]=0;de[o+16>>2]=0;pe[o+20>>0]=0;de[m>>2]=0;de[m+4>>2]=0;de[m+8>>2]=0;de[m+12>>2]=0;de[m+16>>2]=0;pe[m+20>>0]=0;de[a>>2]=0;de[a+4>>2]=0;de[a+8>>2]=0;de[a+12>>2]=0;de[a+16>>2]=0;pe[a+20>>0]=0;de[s>>2]=0;de[s+4>>2]=0;de[s+8>>2]=0;de[s+12>>2]=0;pe[s+16>>0]=0;do{if(((t>>>0>=74?((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)==18552:0)?((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0>=74:0)?((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0<=t>>>0:0){de[l>>2]=e;de[r>>2]=e;de[i>>2]=t;if(Et(u)|0){r=de[l>>2]|0;if((me[r+39>>0]|0)<<8|(me[r+40>>0]|0)){if(!(Ct(u)|0))break;if(!(At(u)|0))break;r=de[l>>2]|0}if(!((me[r+55>>0]|0)<<8|(me[r+56>>0]|0))){g=u;ve=d;return g|0}if(It(u)|0?Ot(u)|0:0){g=u;ve=d;return g|0}}}else p=7}while(0);if((p|0)==7)de[l>>2]=0;Ft(u);if(!(u&7)){Di[de[104>>2]&1](u,0,0,1,de[27]|0)|0;g=0;ve=d;return g|0}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;g=0;ve=d;return g|0}return 0}function yt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+544|0;u=h;l=h+24|0;o=de[e+88>>2]|0;s=(me[o+70+(n<<2)+1>>0]|0)<<16|(me[o+70+(n<<2)>>0]|0)<<24|(me[o+70+(n<<2)+2>>0]|0)<<8|(me[o+70+(n<<2)+3>>0]|0);a=n+1|0;if(a>>>0<(me[o+16>>0]|0)>>>0)o=(me[o+70+(a<<2)+1>>0]|0)<<16|(me[o+70+(a<<2)>>0]|0)<<24|(me[o+70+(a<<2)+2>>0]|0)<<8|(me[o+70+(a<<2)+3>>0]|0);else o=de[e+8>>2]|0;if(o>>>0>s>>>0){l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}de[u>>2]=1154;de[u+4>>2]=3704;de[u+8>>2]=1792;br(l,1100,u)|0;yr(l,h+16|0)|0;l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}function bt(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;var s=0,l=0,u=0,h=0;h=de[e+88>>2]|0;l=((me[h+12>>0]|0)<<8|(me[h+13>>0]|0))>>>a;u=((me[h+14>>0]|0)<<8|(me[h+15>>0]|0))>>>a;l=l>>>0>1?(l+3|0)>>>2:1;u=u>>>0>1?(u+3|0)>>>2:1;h=h+18|0;a=pe[h>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,l)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,u)|0)>>>0>n>>>0){e=0;return e|0}o=(l+1|0)>>>1;s=(u+1|0)>>>1;if(!r){e=0;return e|0}de[e+92>>2]=t;de[e+96>>2]=t;de[e+104>>2]=r;de[e+100>>2]=t+r;de[e+108>>2]=0;de[e+112>>2]=0;switch(me[h>>0]|0|0){case 0:{Mt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Dt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 9:{Rt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 8:case 7:{zt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+12>>2]|0}function kt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+32>>2]|0}function St(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0;l=ve;ve=ve+576|0;a=l+56|0;o=l+40|0;n=l+64|0;u=l;de[u>>2]=40;ut(e,t,u)|0;i=(((de[u+4>>2]|0)>>>r)+3|0)>>>2;t=(((de[u+8>>2]|0)>>>r)+3|0)>>>2;r=u+32|0;e=de[r+4>>2]|0;do{switch(de[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){de[o>>2]=1154;de[o+4>>2]=2663;de[o+8>>2]=1535;br(n,1100,o)|0;yr(n,a)|0;e=0}u=_e(_e(t,i)|0,e)|0;ve=l;return u|0}function Pt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;d=ve;ve=ve+608|0;f=d+80|0;p=d+64|0;s=d+56|0;a=d+40|0;h=d+88|0;m=d;c=d+84|0;de[m>>2]=40;ut(e,t,m)|0;l=(((de[m+4>>2]|0)>>>n)+3|0)>>>2;m=m+32|0;o=de[m+4>>2]|0;do{switch(de[m>>2]|0){case 0:{if(!o)o=8;else u=13;break}case 1:{if(!o)u=12;else u=13;break}case 2:{if(!o)u=12;else u=13;break}case 3:{if(!o)u=12;else u=13;break}case 4:{if(!o)u=12;else u=13;break}case 5:{if(!o)u=12;else u=13;break}case 6:{if(!o)u=12;else u=13;break}case 7:{if(!o)u=12;else u=13;break}case 8:{if(!o)u=12;else u=13;break}case 9:{if(!o)o=8;else u=13;break}default:u=13}}while(0);if((u|0)==12)o=16;else if((u|0)==13){de[a>>2]=1154;de[a+4>>2]=2663;de[a+8>>2]=1535;br(h,1100,a)|0;yr(h,s)|0;o=0}s=_e(o,l)|0;a=_t(e,t)|0;de[c>>2]=r;o=(a|0)==0;if(!(n>>>0>15|(i>>>0<8|o))?(de[a>>2]|0)==519686845:0)yt(a,c,i,s,n)|0;if(o){ve=d;return}if((de[a>>2]|0)!=519686845){ve=d;return}Ft(a);if(!(a&7)){Di[de[104>>2]&1](a,0,0,1,de[27]|0)|0;ve=d;return}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(h,1100,p)|0;yr(h,f)|0;ve=d;return}}function Et(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;a=e+92|0;i=de[e+4>>2]|0;o=e+88|0;n=de[o>>2]|0;t=(me[n+68>>0]|0)<<8|(me[n+67>>0]|0)<<16|(me[n+69>>0]|0);r=i+t|0;n=(me[n+65>>0]|0)<<8|(me[n+66>>0]|0);if(!n){e=0;return e|0}de[a>>2]=r;de[e+96>>2]=r;de[e+104>>2]=n;de[e+100>>2]=i+(n+t);de[e+108>>2]=0;de[e+112>>2]=0;if(!(dt(a,e+116|0)|0)){e=0;return e|0}t=de[o>>2]|0;do{if(!((me[t+39>>0]|0)<<8|(me[t+40>>0]|0))){if(!((me[t+55>>0]|0)<<8|(me[t+56>>0]|0))){e=0;return e|0}}else{if(!(dt(a,e+140|0)|0)){e=0;return e|0}if(dt(a,e+188|0)|0){t=de[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((me[t+55>>0]|0)<<8|(me[t+56>>0]|0)){if(!(dt(a,e+164|0)|0)){e=0;return e|0}if(!(dt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function Ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ve;ve=ve+592|0;l=d+16|0;s=d;a=d+72|0;p=d+24|0;i=e+88|0;t=de[i>>2]|0;f=(me[t+39>>0]|0)<<8|(me[t+40>>0]|0);h=e+236|0;o=e+240|0;r=de[o>>2]|0;if((r|0)!=(f|0)){if(r>>>0<=f>>>0){do{if((de[e+244>>2]|0)>>>0>>0){if(nt(h,f,(r+1|0)==(f|0),4,0)|0){t=de[o>>2]|0;break}pe[e+248>>0]=1;p=0;ve=d;return p|0}else t=r}while(0);Yr((de[h>>2]|0)+(t<<2)|0,0,f-t<<2|0)|0;t=de[i>>2]|0}de[o>>2]=f}u=e+92|0;r=de[e+4>>2]|0;i=(me[t+34>>0]|0)<<8|(me[t+33>>0]|0)<<16|(me[t+35>>0]|0);n=r+i|0;t=(me[t+37>>0]|0)<<8|(me[t+36>>0]|0)<<16|(me[t+38>>0]|0);if(!t){p=0;ve=d;return p|0}de[u>>2]=n;de[e+96>>2]=n;de[e+104>>2]=t;de[e+100>>2]=r+(t+i);de[e+108>>2]=0;de[e+112>>2]=0;de[p+20>>2]=0;de[p>>2]=0;de[p+4>>2]=0;de[p+8>>2]=0;de[p+12>>2]=0;pe[p+16>>0]=0;e=p+24|0;de[p+44>>2]=0;de[e>>2]=0;de[e+4>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;pe[e+16>>0]=0;if(dt(u,p)|0?(c=p+24|0,dt(u,c)|0):0){if(!(de[o>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(a,l)|0}if(!f)t=1;else{i=0;n=0;o=0;t=0;a=0;e=0;s=0;r=de[h>>2]|0;while(1){i=(gt(u,p)|0)+i&31;n=(gt(u,c)|0)+n&63;o=(gt(u,p)|0)+o&31;t=(gt(u,p)|0)+t|0;a=(gt(u,c)|0)+a&63;e=(gt(u,p)|0)+e&31;de[r>>2]=n<<5|i<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(f|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ct(p+24|0);ct(p);p=t;ve=d;return p|0}function At(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+1024|0;s=S+16|0;a=S;o=S+504|0;k=S+480|0;w=S+284|0;T=S+88|0;x=S+24|0;n=de[e+88>>2]|0;b=(me[n+47>>0]|0)<<8|(me[n+48>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+42>>0]|0)<<8|(me[n+41>>0]|0)<<16|(me[n+43>>0]|0);i=t+r|0;n=(me[n+45>>0]|0)<<8|(me[n+44>>0]|0)<<16|(me[n+46>>0]|0);if(!n){k=0;ve=S;return k|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-3;n=-3;while(1){de[w+(r<<2)>>2]=i;de[T+(r<<2)>>2]=n;t=(i|0)>2;r=r+1|0;if((r|0)==49)break;else{i=t?-3:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=de[r>>2]|0;e:do{if((t|0)==(b|0))l=13;else{if(t>>>0<=b>>>0){do{if((de[e+260>>2]|0)>>>0>>0)if(nt(_,b,(t+1|0)==(b|0),4,0)|0){t=de[r>>2]|0;break}else{pe[e+264>>0]=1;t=0;break e}}while(0);Yr((de[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}de[r>>2]=b;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);de[r>>2]=(me[1725+(de[i>>2]|0)>>0]|0)<<2|(me[1725+(de[x>>2]|0)>>0]|0)|(me[1725+(de[n>>2]|0)>>0]|0)<<4|(me[1725+(de[e>>2]|0)>>0]|0)<<6|(me[1725+(de[o>>2]|0)>>0]|0)<<8|(me[1725+(de[a>>2]|0)>>0]|0)<<10|(me[1725+(de[s>>2]|0)>>0]|0)<<12|(me[1725+(de[l>>2]|0)>>0]|0)<<14|(me[1725+(de[u>>2]|0)>>0]|0)<<16|(me[1725+(de[h>>2]|0)>>0]|0)<<18|(me[1725+(de[c>>2]|0)>>0]|0)<<20|(me[1725+(de[f>>2]|0)>>0]|0)<<22|(me[1725+(de[p>>2]|0)>>0]|0)<<24|(me[1725+(de[d>>2]|0)>>0]|0)<<26|(me[1725+(de[m>>2]|0)>>0]|0)<<28|(me[1725+(de[g>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function It(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ve;ve=ve+560|0;l=f+16|0;s=f;a=f+48|0;c=f+24|0;n=de[e+88>>2]|0;h=(me[n+55>>0]|0)<<8|(me[n+56>>0]|0);u=e+92|0;t=de[e+4>>2]|0;r=(me[n+50>>0]|0)<<8|(me[n+49>>0]|0)<<16|(me[n+51>>0]|0);i=t+r|0;n=(me[n+53>>0]|0)<<8|(me[n+52>>0]|0)<<16|(me[n+54>>0]|0);if(!n){c=0;ve=f;return c|0}de[u>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[c+20>>2]=0;de[c>>2]=0;de[c+4>>2]=0;de[c+8>>2]=0;de[c+12>>2]=0;pe[c+16>>0]=0;e:do{if(dt(u,c)|0){o=e+268|0;r=e+272|0;t=de[r>>2]|0;if((t|0)!=(h|0)){if(t>>>0<=h>>>0){do{if((de[e+276>>2]|0)>>>0>>0)if(nt(o,h,(t+1|0)==(h|0),2,0)|0){t=de[r>>2]|0;break}else{pe[e+280>>0]=1;t=0;break e}}while(0);Yr((de[o>>2]|0)+(t<<1)|0,0,h-t<<1|0)|0}de[r>>2]=h}if(!h){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(a,l)|0;t=1;break}r=0;i=0;n=0;t=de[o>>2]|0;while(1){l=gt(u,c)|0;r=l+r&255;i=(gt(u,c)|0)+i&255;$[t>>1]=i<<8|r;n=n+1|0;if((n|0)==(h|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ct(c);c=t;ve=f;return c|0}function Ot(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0;S=ve;ve=ve+2432|0;s=S+16|0;a=S;o=S+1912|0;k=S+1888|0;w=S+988|0;T=S+88|0;x=S+24|0;n=de[e+88>>2]|0;b=(me[n+63>>0]|0)<<8|(me[n+64>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+58>>0]|0)<<8|(me[n+57>>0]|0)<<16|(me[n+59>>0]|0);i=t+r|0;n=(me[n+61>>0]|0)<<8|(me[n+60>>0]|0)<<16|(me[n+62>>0]|0);if(!n){k=0;ve=S;return k|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-7;n=-7;while(1){de[w+(r<<2)>>2]=i;de[T+(r<<2)>>2]=n;t=(i|0)>6;r=r+1|0;if((r|0)==225)break;else{i=t?-7:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;i=e+288|0;t=de[i>>2]|0;e:do{if((t|0)==(r|0))l=13;else{if(t>>>0<=r>>>0){do{if((de[e+292>>2]|0)>>>0>>0)if(nt(_,r,(t+1|0)==(r|0),2,0)|0){t=de[i>>2]|0;break}else{pe[e+296>>0]=1;t=0;break e}}while(0);Yr((de[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}de[i>>2]=r;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{P=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(P<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(P<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);P=me[1729+(de[a>>2]|0)>>0]|0;$[r>>1]=(me[1729+(de[i>>2]|0)>>0]|0)<<3|(me[1729+(de[x>>2]|0)>>0]|0)|(me[1729+(de[n>>2]|0)>>0]|0)<<6|(me[1729+(de[e>>2]|0)>>0]|0)<<9|(me[1729+(de[o>>2]|0)>>0]|0)<<12|P<<15;E=me[1729+(de[c>>2]|0)>>0]|0;$[r+2>>1]=(me[1729+(de[s>>2]|0)>>0]|0)<<2|P>>>1|(me[1729+(de[l>>2]|0)>>0]|0)<<5|(me[1729+(de[u>>2]|0)>>0]|0)<<8|(me[1729+(de[h>>2]|0)>>0]|0)<<11|E<<14;$[r+4>>1]=(me[1729+(de[f>>2]|0)>>0]|0)<<1|E>>>2|(me[1729+(de[p>>2]|0)>>0]|0)<<4|(me[1729+(de[d>>2]|0)>>0]|0)<<7|(me[1729+(de[m>>2]|0)>>0]|0)<<10|(me[1729+(de[g>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ct(k);E=t;ve=S;return E|0}function Mt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;he=ve;ve=ve+720|0;ue=he+184|0;se=he+168|0;ae=he+160|0;oe=he+144|0;ne=he+136|0;ie=he+120|0;re=he+112|0;ee=he+96|0;$=he+88|0;Q=he+72|0;K=he+64|0;J=he+48|0;Z=he+40|0;le=he+24|0;te=he+16|0;Y=he;G=he+208|0;V=he+192|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;W=de[H>>2]|0;r=pe[(de[e+88>>2]|0)+17>>0]|0;q=i>>>2;if(!(r<<24>>24)){ve=he;return 1}U=(s|0)==0;X=s+-1|0;M=(o&1|0)!=0;D=i<<1;R=e+92|0;z=e+116|0;F=e+140|0;L=e+236|0;j=a+-1|0;O=(n&1|0)!=0;I=e+188|0;S=e+252|0;P=q+1|0;E=q+2|0;C=q+3|0;A=j<<4;T=r&255;r=0;o=0;n=1;k=0;do{if(!U){x=de[t+(k<<2)>>2]|0;w=0;while(1){_=w&1;l=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=l?a:-1;u=l?0:j;e=(w|0)==(X|0);y=M&e;if((u|0)!=(b|0)){g=M&e^1;m=l?x:x+A|0;while(1){if((n|0)==1)n=gt(R,z)|0|512;d=n&7;n=n>>>3;l=me[1823+d>>0]|0;e=0;do{f=(gt(R,F)|0)+o|0;p=f-B|0;o=p>>31;o=o&f|p&~o;if((de[N>>2]|0)>>>0<=o>>>0){de[Y>>2]=1154;de[Y+4>>2]=903;de[Y+8>>2]=1781;br(G,1100,Y)|0;yr(G,te)|0}de[V+(e<<2)>>2]=de[(de[L>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);p=O&(u|0)==(j|0);if(y|p){f=0;do{h=_e(f,i)|0;e=m+h|0;l=(f|0)==0|g;c=f<<1;fe=(gt(R,I)|0)+r|0;ce=fe-W|0;r=ce>>31;r=r&fe|ce&~r;do{if(p){if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(G,1100,oe)|0;yr(G,ae)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r}else{if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(G,1100,ie)|0;yr(G,ne)|0}de[m+(h+4)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;de[m+(h+8)>>2]=de[V+((me[(c|1)+(1831+(d<<2))>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(G,1100,se)|0;yr(G,ue)|0}de[m+(h+12)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}}while(0);f=f+1|0}while((f|0)!=2)}else{de[m>>2]=de[V+((me[1831+(d<<2)>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[le>>2]=1154;de[le+4>>2]=903;de[le+8>>2]=1781;br(G,1100,le)|0;yr(G,Z)|0}de[m+4>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+8>>2]=de[V+((me[1831+(d<<2)+1>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(G,1100,J)|0;yr(G,K)|0}de[m+12>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(q<<2)>>2]=de[V+((me[1831+(d<<2)+2>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(G,1100,Q)|0;yr(G,$)|0}de[m+(P<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2];de[m+(E<<2)>>2]=de[V+((me[1831+(d<<2)+3>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-W|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(G,1100,ee)|0;yr(G,re)|0}de[m+(C<<2)>>2]=de[(de[S>>2]|0)+(r<<2)>>2]}u=u+_|0;if((u|0)==(b|0))break;else m=m+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+D|0}}k=k+1|0}while((k|0)!=(T|0));ve=he;return 1}function Dt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;ce=ve;ve=ve+640|0;le=ce+88|0;se=ce+72|0;ae=ce+64|0;oe=ce+48|0;ne=ce+40|0;he=ce+24|0;ue=ce+16|0;ie=ce;te=ce+128|0;re=ce+112|0;ee=ce+96|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;K=de[H>>2]|0;Q=e+272|0;$=de[Q>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ce;return 1}X=(s|0)==0;W=s+-1|0;q=i<<1;G=e+92|0;V=e+116|0;Y=a+-1|0;Z=e+212|0;J=e+188|0;j=(n&1|0)==0;L=(o&1|0)==0;O=e+288|0;M=e+284|0;D=e+252|0;R=e+140|0;z=e+236|0;F=e+164|0;A=e+268|0;I=Y<<5;E=r&255;r=0;n=0;o=0;e=0;l=1;C=0;do{if(!X){S=de[t+(C<<2)>>2]|0;P=0;while(1){T=P&1;u=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;k=u?a:-1;h=u?0:Y;if((h|0)!=(k|0)){x=L|(P|0)!=(W|0);b=u?S:S+I|0;while(1){if((l|0)==1)l=gt(G,V)|0|512;y=l&7;l=l>>>3;c=me[1823+y>>0]|0;u=0;do{v=(gt(G,F)|0)+n|0;_=v-$|0;n=_>>31;n=n&v|_&~n;if((de[Q>>2]|0)>>>0<=n>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(te,1100,ie)|0;yr(te,ue)|0}de[ee+(u<<2)>>2]=ge[(de[A>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(gt(G,R)|0)+e|0;_=v-B|0;e=_>>31;e=e&v|_&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[he>>2]=1154;de[he+4>>2]=903;de[he+8>>2]=1781;br(te,1100,he)|0;yr(te,ne)|0}de[re+(u<<2)>>2]=de[(de[z>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=j|(h|0)!=(Y|0);g=0;v=b;while(1){m=x|(g|0)==0;d=g<<1;f=0;p=v;while(1){c=(gt(G,Z)|0)+r|0;u=c-U|0;r=u>>31;r=r&c|u&~r;u=(gt(G,J)|0)+o|0;c=u-K|0;o=c>>31;o=o&u|c&~o;if((_|(f|0)==0)&m){u=me[f+d+(1831+(y<<2))>>0]|0;c=r*3|0;if((de[O>>2]|0)>>>0<=c>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}fe=de[M>>2]|0;de[p>>2]=(ge[fe+(c<<1)>>1]|0)<<16|de[ee+(u<<2)>>2];de[p+4>>2]=(ge[fe+(c+2<<1)>>1]|0)<<16|(ge[fe+(c+1<<1)>>1]|0);de[p+8>>2]=de[re+(u<<2)>>2];if((de[H>>2]|0)>>>0<=o>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(te,1100,se)|0;yr(te,le)|0}de[p+12>>2]=de[(de[D>>2]|0)+(o<<2)>>2]}f=f+1|0;if((f|0)==2)break;else p=p+16|0}g=g+1|0;if((g|0)==2)break;else v=v+i|0}h=h+T|0;if((h|0)==(k|0))break;else b=b+w|0}}P=P+1|0;if((P|0)==(s|0))break;else S=S+q|0}}C=C+1|0}while((C|0)!=(E|0));ve=ce;return 1}function Rt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0;K=ve;ve=ve+608|0;Y=K+64|0;V=K+48|0;G=K+40|0;J=K+24|0;Z=K+16|0;q=K;W=K+88|0;H=K+72|0;D=e+272|0;R=de[D>>2]|0;r=de[e+88>>2]|0;z=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=K;return 1}F=(s|0)==0;L=s+-1|0;j=i<<1;N=e+92|0;B=e+116|0;U=a+-1|0;X=e+212|0;M=(o&1|0)==0;A=e+288|0;I=e+284|0;O=e+164|0;E=e+268|0;C=U<<4;P=r&255;S=(n&1|0)!=0;r=0;o=0;e=1;k=0;do{if(!F){w=de[t+(k<<2)>>2]|0;T=0;while(1){b=T&1;n=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=n?a:-1;l=n?0:U;if((l|0)!=(x|0)){_=M|(T|0)!=(L|0);v=n?w:w+C|0;while(1){if((e|0)==1)e=gt(N,B)|0|512;g=e&7;e=e>>>3;u=me[1823+g>>0]|0;n=0;do{d=(gt(N,O)|0)+o|0;m=d-R|0;o=m>>31;o=o&d|m&~o;if((de[D>>2]|0)>>>0<=o>>>0){de[q>>2]=1154;de[q+4>>2]=903;de[q+8>>2]=1781;br(W,1100,q)|0;yr(W,Z)|0}de[H+(n<<2)>>2]=ge[(de[E>>2]|0)+(o<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(U|0)&S;p=0;d=v;while(1){f=_|(p|0)==0;c=p<<1;n=(gt(N,X)|0)+r|0;h=n-z|0;u=h>>31;u=u&n|h&~u;if(f){r=me[1831+(g<<2)+c>>0]|0;n=u*3|0;if((de[A>>2]|0)>>>0<=n>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(W,1100,J)|0;yr(W,G)|0}h=de[I>>2]|0;de[d>>2]=(ge[h+(n<<1)>>1]|0)<<16|de[H+(r<<2)>>2];de[d+4>>2]=(ge[h+(n+2<<1)>>1]|0)<<16|(ge[h+(n+1<<1)>>1]|0)}h=d+8|0;n=(gt(N,X)|0)+u|0;u=n-z|0;r=u>>31;r=r&n|u&~r;if(!(m|f^1)){n=me[(c|1)+(1831+(g<<2))>>0]|0;u=r*3|0;if((de[A>>2]|0)>>>0<=u>>>0){de[V>>2]=1154;de[V+4>>2]=903;de[V+8>>2]=1781;br(W,1100,V)|0;yr(W,Y)|0}f=de[I>>2]|0;de[h>>2]=(ge[f+(u<<1)>>1]|0)<<16|de[H+(n<<2)>>2];de[d+12>>2]=(ge[f+(u+2<<1)>>1]|0)<<16|(ge[f+(u+1<<1)>>1]|0)}p=p+1|0;if((p|0)==2)break;else d=d+i|0}l=l+b|0;if((l|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+j|0}}k=k+1|0}while((k|0)!=(P|0));ve=K;return 1}function zt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ie=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;$=ae+40|0;oe=ae+24|0;ne=ae+16|0;Q=ae;K=ae+128|0;Z=ae+112|0;J=ae+96|0;N=e+272|0;B=de[N>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;H=s+-1|0;W=i<<1;q=e+92|0;G=e+116|0;V=a+-1|0;Y=e+212|0;j=(n&1|0)==0;L=(o&1|0)==0;R=e+288|0;z=e+284|0;F=e+164|0;M=e+268|0;D=V<<5;I=r&255;r=0;n=0;o=0;e=0;l=1;O=0;do{if(!X){C=de[t+(O<<2)>>2]|0;A=0;while(1){P=A&1;u=(P|0)==0;S=(P<<6^64)+-32|0;P=(P<<1^2)+-1|0;E=u?a:-1;h=u?0:V;if((h|0)!=(E|0)){k=L|(A|0)!=(H|0);T=u?C:C+D|0;while(1){if((l|0)==1)l=gt(q,G)|0|512;w=l&7;l=l>>>3;c=me[1823+w>>0]|0;u=0;do{b=(gt(q,F)|0)+e|0;x=b-B|0;e=x>>31;e=e&b|x&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(K,1100,Q)|0;yr(K,ne)|0}de[Z+(u<<2)>>2]=ge[(de[M>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{b=(gt(q,F)|0)+n|0;x=b-B|0;n=x>>31;n=n&b|x&~n;if((de[N>>2]|0)>>>0<=n>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(K,1100,oe)|0;yr(K,$)|0}de[J+(u<<2)>>2]=ge[(de[M>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);x=j|(h|0)!=(V|0);y=0;b=T;while(1){_=k|(y|0)==0;v=y<<1;m=0;g=b;while(1){d=(gt(q,Y)|0)+o|0;p=d-U|0;o=p>>31;o=o&d|p&~o;p=(gt(q,Y)|0)+r|0;d=p-U|0;r=d>>31;r=r&p|d&~r;if((x|(m|0)==0)&_){p=me[m+v+(1831+(w<<2))>>0]|0;d=o*3|0;u=de[R>>2]|0;if(u>>>0<=d>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(K,1100,ee)|0;yr(K,te)|0;u=de[R>>2]|0}c=de[z>>2]|0;f=r*3|0;if(u>>>0>f>>>0)u=c;else{de[re>>2]=1154;de[re+4>>2]=903;de[re+8>>2]=1781;br(K,1100,re)|0;yr(K,ie)|0;u=de[z>>2]|0}de[g>>2]=(ge[c+(d<<1)>>1]|0)<<16|de[Z+(p<<2)>>2];de[g+4>>2]=(ge[c+(d+2<<1)>>1]|0)<<16|(ge[c+(d+1<<1)>>1]|0);de[g+8>>2]=(ge[u+(f<<1)>>1]|0)<<16|de[J+(p<<2)>>2];de[g+12>>2]=(ge[u+(f+2<<1)>>1]|0)<<16|(ge[u+(f+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else g=g+16|0}y=y+1|0;if((y|0)==2)break;else b=b+i|0}h=h+P|0;if((h|0)==(E|0))break;else T=T+S|0}}A=A+1|0;if((A|0)==(s|0))break;else C=C+W|0}}O=O+1|0}while((O|0)!=(I|0));ve=ae;return 1}function Ft(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ve;ve=ve+608|0;c=f+88|0;h=f+72|0;l=f+64|0;s=f+48|0;o=f+40|0;a=f+24|0;n=f+16|0;i=f;u=f+96|0;de[e>>2]=0;t=e+284|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[i>>2]=1154;de[i+4>>2]=2499;de[i+8>>2]=1516;br(u,1100,i)|0;yr(u,n)|0}de[t>>2]=0;de[e+288>>2]=0;de[e+292>>2]=0}pe[e+296>>0]=0;t=e+268|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[a>>2]=1154;de[a+4>>2]=2499;de[a+8>>2]=1516;br(u,1100,a)|0;yr(u,o)|0}de[t>>2]=0;de[e+272>>2]=0;de[e+276>>2]=0}pe[e+280>>0]=0;t=e+252|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1516;br(u,1100,s)|0;yr(u,l)|0}de[t>>2]=0;de[e+256>>2]=0;de[e+260>>2]=0}pe[e+264>>0]=0;t=e+236|0;r=de[t>>2]|0;if(!r){c=e+248|0;pe[c>>0]=0;c=e+212|0;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[h>>2]=1154;de[h+4>>2]=2499;de[h+8>>2]=1516;br(u,1100,h)|0;yr(u,c)|0}de[t>>2]=0;de[e+240>>2]=0;de[e+244>>2]=0;c=e+248|0;pe[c>>0]=0;c=e+212|0;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}function Lt(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;de[r>>2]=t;t=de[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function jt(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Fe(200,2)|0)){t=Re(de[49]|0)|0;ve=e;return t|0}else Lt(2090,e);return 0}function Nt(e){e=e|0;Ur(e);return}function Bt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Oi[e&3]();Lt(2139,t)}function Ut(){var e=0,t=0;e=jt()|0;if(((e|0)!=0?(t=de[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(de[e>>2]&-256|0)==1126902528?(de[e+4>>2]|0)==1129074247:0):0)Bt(de[t+12>>2]|0);t=de[28]|0;de[28]=t+0;Bt(t)}function Xt(e){e=e|0;return}function Ht(e){e=e|0;return}function Wt(e){e=e|0;return}function qt(e){e=e|0;return}function Gt(e){e=e|0;Nt(e);return}function Vt(e){e=e|0;Nt(e);return}function Yt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(n=Qt(t,24,40,0)|0,(n|0)!=0):0){t=o;i=t+56|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(i|0));de[o>>2]=n;de[o+8>>2]=e;de[o+12>>2]=-1;de[o+48>>2]=1;Ri[de[(de[n>>2]|0)+28>>2]&3](n,o,de[r>>2]|0,1);if((de[o+24>>2]|0)==1){de[r>>2]=de[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Zt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0;e=t+16|0;n=de[e>>2]|0;do{if(n){if((n|0)!=(r|0)){i=t+36|0;de[i>>2]=(de[i>>2]|0)+1;de[t+24>>2]=2;pe[t+54>>0]=1;break}e=t+24|0;if((de[e>>2]|0)==2)de[e>>2]=i}else{de[e>>2]=r;de[t+24>>2]=i;de[t+36>>2]=1}}while(0);return}function Jt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);return}function Kt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);else{e=de[e+8>>2]|0;Ri[de[(de[e>>2]|0)+28>>2]&3](e,t,r,i)}return}function Qt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0;p=ve;ve=ve+64|0;f=p;c=de[e>>2]|0;h=e+(de[c+-8>>2]|0)|0;c=de[c+-4>>2]|0;de[f>>2]=r;de[f+4>>2]=e;de[f+8>>2]=t;de[f+12>>2]=i;i=f+16|0;e=f+20|0;t=f+24|0;n=f+28|0;o=f+32|0;a=f+40|0;s=(c|0)==(r|0);l=i;u=l+36|0;do{de[l>>2]=0;l=l+4|0}while((l|0)<(u|0));$[i+36>>1]=0;pe[i+38>>0]=0;e:do{if(s){de[f+48>>2]=1;Mi[de[(de[r>>2]|0)+20>>2]&3](r,f,h,h,1,0);i=(de[t>>2]|0)==1?h:0}else{Ei[de[(de[c>>2]|0)+24>>2]&3](c,f,h,1,0);switch(de[f+36>>2]|0){case 0:{i=(de[a>>2]|0)==1&(de[n>>2]|0)==1&(de[o>>2]|0)==1?de[e>>2]|0:0;break e}case 1:break;default:{i=0;break e}}if((de[t>>2]|0)!=1?!((de[a>>2]|0)==0&(de[n>>2]|0)==1&(de[o>>2]|0)==1):0){i=0;break}i=de[i>>2]|0}}while(0);ve=p;return i|0}function $t(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;pe[t+53>>0]=1;do{if((de[t+4>>2]|0)==(i|0)){pe[t+52>>0]=1;i=t+16|0;e=de[i>>2]|0;if(!e){de[i>>2]=r;de[t+24>>2]=n;de[t+36>>2]=1;if(!((n|0)==1?(de[t+48>>2]|0)==1:0))break;pe[t+54>>0]=1;break}if((e|0)!=(r|0)){n=t+36|0;de[n>>2]=(de[n>>2]|0)+1;pe[t+54>>0]=1;break}e=t+24|0;i=de[e>>2]|0;if((i|0)==2){de[e>>2]=n;i=n}if((i|0)==1?(de[t+48>>2]|0)==1:0)pe[t+54>>0]=1}}while(0);return}function er(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0;e:do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(o=t+28|0,(de[o>>2]|0)!=1):0)de[o>>2]=i}else{if((e|0)!=(de[t>>2]|0)){s=de[e+8>>2]|0;Ei[de[(de[s>>2]|0)+24>>2]&3](s,t,r,i,n);break}if((de[t+16>>2]|0)!=(r|0)?(a=t+20|0,(de[a>>2]|0)!=(r|0)):0){de[t+32>>2]=i;i=t+44|0;if((de[i>>2]|0)==4)break;o=t+52|0;pe[o>>0]=0;l=t+53|0;pe[l>>0]=0;e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,r,1,n);if(pe[l>>0]|0){if(!(pe[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){de[a>>2]=r;l=t+40|0;de[l>>2]=(de[l>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0){pe[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;de[i>>2]=4;break e}}while(0);de[i>>2]=3;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function tr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0;do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(a=t+28|0,(de[a>>2]|0)!=1):0)de[a>>2]=i}else if((e|0)==(de[t>>2]|0)){if((de[t+16>>2]|0)!=(r|0)?(o=t+20|0,(de[o>>2]|0)!=(r|0)):0){de[t+32>>2]=i;de[o>>2]=r;n=t+40|0;de[n>>2]=(de[n>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0)pe[t+54>>0]=1;de[t+44>>2]=4;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function rr(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))$t(0,t,r,i,n);else{e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,i,n,o)}return}function ir(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))$t(0,t,r,i,n);return}function nr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+16|0;i=n;de[i>>2]=de[r>>2];e=Pi[de[(de[e>>2]|0)+16>>2]&7](e,t,i)|0;if(e)de[r>>2]=de[i>>2];ve=n;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=(Qt(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,i=0,n=0,o=0,a=0,s=0;n=ve;ve=ve+48|0;a=n+32|0;r=n+24|0;s=n+16|0;o=n;n=n+36|0;e=jt()|0;if((e|0)!=0?(i=de[e>>2]|0,(i|0)!=0):0){e=i+48|0;t=de[e>>2]|0;e=de[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){de[r>>2]=de[51];Lt(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=de[i+44>>2]|0;else e=i+80|0;de[n>>2]=e;i=de[i>>2]|0;e=de[i+4>>2]|0;if(Pi[de[(de[8>>2]|0)+16>>2]&7](8,i,n)|0){s=de[n>>2]|0;n=de[51]|0;s=Ai[de[(de[s>>2]|0)+8>>2]&1](s)|0;de[o>>2]=n;de[o+4>>2]=e;de[o+8>>2]=s;Lt(2282,o)}else{de[s>>2]=de[51];de[s+4>>2]=e;Lt(2327,s)}}Lt(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(Le(196,6)|0)){ve=e;return}else Lt(2179,e)}function lr(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(Be(de[49]|0,0)|0)){ve=t;return}else Lt(2229,t)}function ur(e){e=e|0;var t=0,r=0;t=0;while(1){if((me[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(pe[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function hr(){var e=0;if(!(de[52]|0))e=264;else{e=(ze()|0)+60|0;e=de[e>>2]|0}return e|0}function cr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=hr()|0;de[t>>2]=0-e;e=-1}return e|0}function fr(e,t){e=+e;t=t|0;var r=0,i=0,n=0;ee[te>>3]=e;r=de[te>>2]|0;i=de[te+4>>2]|0;n=Zr(r|0,i|0,52)|0;n=n&2047;switch(n|0){case 0:{if(e!=0.0){e=+fr(e*18446744073709552.0e3,t);r=(de[t>>2]|0)+-64|0}else r=0;de[t>>2]=r;break}case 2047:break;default:{de[t>>2]=n+-1022;de[te>>2]=r;de[te+4>>2]=i&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function pr(e,t){e=+e;t=t|0;return+ +fr(e,t)}function dr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){pe[e>>0]=t;e=1;break}if(t>>>0<2048){pe[e>>0]=t>>>6|192;pe[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){pe[e>>0]=t>>>12|224;pe[e+1>>0]=t>>>6&63|128;pe[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){pe[e>>0]=t>>>18|240;pe[e+1>>0]=t>>>12&63|128;pe[e+2>>0]=t>>>6&63|128;pe[e+3>>0]=t&63|128;e=4;break}else{e=hr()|0;de[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function mr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=dr(e,t,0)|0;return e|0}function gr(e){e=e|0;var t=0,r=0;do{if(e){if((de[e+76>>2]|0)<=-1){t=Dr(e)|0;break}r=(kr(e)|0)==0;t=Dr(e)|0;if(!r)Sr(e)}else{if(!(de[65]|0))t=0;else t=gr(de[65]|0)|0;Ue(236);e=de[58]|0;if(e)do{if((de[e+76>>2]|0)>-1)r=kr(e)|0;else r=0;if((de[e+20>>2]|0)>>>0>(de[e+28>>2]|0)>>>0)t=Dr(e)|0|t;if(r)Sr(e);e=de[e+56>>2]|0}while((e|0)!=0);je(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0;if((de[t+76>>2]|0)>=0?(kr(t)|0)!=0:0){if((pe[t+75>>0]|0)!=(e|0)?(i=t+20|0,n=de[i>>2]|0,n>>>0<(de[t+16>>2]|0)>>>0):0){de[i>>2]=n+1;pe[n>>0]=e;r=e&255}else r=Pr(t,e)|0;Sr(t)}else a=3;do{if((a|0)==3){if((pe[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=de[o>>2]|0,r>>>0<(de[t+16>>2]|0)>>>0):0){de[o>>2]=r+1;pe[r>>0]=e;r=e&255;break}r=Pr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=r+16|0;n=de[i>>2]|0;if(!n)if(!(Or(r)|0)){n=de[i>>2]|0;o=4}else i=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=de[a>>2]|0;if((n-o|0)>>>0>>0){i=Pi[de[r+36>>2]&7](r,e,t)|0;break}t:do{if((pe[r+75>>0]|0)>-1){i=t;while(1){if(!i){n=o;i=0;break t}n=i+-1|0;if((pe[e+n>>0]|0)==10)break;else i=n}if((Pi[de[r+36>>2]&7](r,e,i)|0)>>>0>>0)break e;t=t-i|0;e=e+i|0;n=de[a>>2]|0}else{n=o;i=0}}while(0);Qr(n|0,e|0,t|0)|0;de[a>>2]=(de[a>>2]|0)+t;i=i+t|0}}while(0);return i|0}function yr(e,t){e=e|0;t=t|0;var r=0,i=0;r=ve;ve=ve+16|0;i=r;de[i>>2]=t;t=xr(de[64]|0,e,i)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=ve;ve=ve+16|0;n=i;de[n>>2]=r;r=Tr(e,t,n)|0;ve=i;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ve;ve=ve+224|0;c=m+120|0;d=m+80|0;p=m;f=m+136|0;i=d;n=i+40|0;do{de[i>>2]=0;i=i+4|0}while((i|0)<(n|0));de[c>>2]=de[r>>2];if((Rr(0,t,c,p,d)|0)<0)r=-1;else{if((de[e+76>>2]|0)>-1)u=kr(e)|0;else u=0;r=de[e>>2]|0;h=r&32;if((pe[e+74>>0]|0)<1)de[e>>2]=r&-33;r=e+48|0;if(!(de[r>>2]|0)){n=e+44|0;o=de[n>>2]|0;de[n>>2]=f;a=e+28|0;de[a>>2]=f;s=e+20|0;de[s>>2]=f;de[r>>2]=80;l=e+16|0;de[l>>2]=f+80;i=Rr(e,t,c,p,d)|0;if(o){Pi[de[e+36>>2]&7](e,0,0)|0;i=(de[s>>2]|0)==0?-1:i;de[n>>2]=o;de[r>>2]=0;de[l>>2]=0;de[a>>2]=0;de[s>>2]=0}}else i=Rr(e,t,c,p,d)|0;r=de[e>>2]|0;de[e>>2]=r|h;if(u)Sr(e);r=(r&32|0)==0?i:-1}ve=m;return r|0}function wr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+128|0;n=h+112|0;u=h;o=u;a=268;s=o+112|0;do{de[o>>2]=de[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;l=4}else{t=hr()|0;de[t>>2]=75;t=-1}else{n=e;l=4}if((l|0)==4){l=-2-n|0;l=t>>>0>l>>>0?l:t;de[u+48>>2]=l;e=u+20|0;de[e>>2]=n;de[u+44>>2]=n;t=n+l|0;n=u+16|0;de[n>>2]=t;de[u+28>>2]=t;t=xr(u,r,i)|0;if(l){r=de[e>>2]|0;pe[r+(((r|0)==(de[n>>2]|0))<<31>>31)>>0]=0}}ve=h;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function kr(e){e=e|0;return 0}function Sr(e){e=e|0;return}function Pr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+16|0;s=l;a=t&255;pe[s>>0]=a;i=e+16|0;n=de[i>>2]|0;if(!n)if(!(Or(e)|0)){n=de[i>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){i=e+20|0;o=de[i>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(pe[e+75>>0]|0)):0){de[i>>2]=o+1;pe[o>>0]=a;break}if((Pi[de[e+36>>2]&7](e,s,1)|0)==1)r=me[s>>0]|0;else r=-1}}while(0);ve=l;return r|0}function Er(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;de[r>>2]=de[e+60>>2];e=cr(Pe(6,r|0)|0)|0;ve=t;return e|0}function Cr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0;n=ve;ve=ve+32|0;o=n;i=n+20|0;de[o>>2]=de[e+60>>2];de[o+4>>2]=0;de[o+8>>2]=t;de[o+12>>2]=i;de[o+16>>2]=r;if((cr(qe(140,o|0)|0)|0)<0){de[i>>2]=-1;e=-1}else e=de[i>>2]|0;ve=n;return e|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ve;ve=ve+48|0;c=d+16|0;h=d;i=d+32|0;f=e+28|0;n=de[f>>2]|0;de[i>>2]=n;p=e+20|0;n=(de[p>>2]|0)-n|0;de[i+4>>2]=n;de[i+8>>2]=t;de[i+12>>2]=r;l=e+60|0;u=e+44|0;t=2;n=n+r|0;while(1){if(!(de[52]|0)){de[c>>2]=de[l>>2];de[c+4>>2]=i;de[c+8>>2]=t;a=cr(Ge(146,c|0)|0)|0}else{He(7,e|0);de[h>>2]=de[l>>2];de[h+4>>2]=i;de[h+8>>2]=t;a=cr(Ge(146,h|0)|0)|0;ke(0)}if((n|0)==(a|0)){n=6;break}if((a|0)<0){n=8;break}n=n-a|0;o=de[i+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){de[f>>2]=(de[f>>2]|0)+a;s=o;t=2}else s=o;else{s=de[u>>2]|0;de[f>>2]=s;de[p>>2]=s;s=de[i+12>>2]|0;a=a-o|0;i=i+8|0;t=t+-1|0}de[i>>2]=(de[i>>2]|0)+a;de[i+4>>2]=s-a}if((n|0)==6){c=de[u>>2]|0;de[e+16>>2]=c+(de[e+48>>2]|0);e=c;de[f>>2]=e;de[p>>2]=e}else if((n|0)==8){de[e+16>>2]=0;de[f>>2]=0;de[p>>2]=0;de[e>>2]=de[e>>2]|32;if((t|0)==2)r=0;else r=r-(de[i+4>>2]|0)|0}ve=d;return r|0}function Ir(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+80|0;i=n;de[e+36>>2]=3;if((de[e>>2]&64|0)==0?(de[i>>2]=de[e+60>>2],de[i+4>>2]=21505,de[i+8>>2]=n+12,(Se(54,i|0)|0)!=0):0)pe[e+75>>0]=-1;i=Ar(e,t,r)|0;ve=n;return i|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=pe[t>>0]|0;pe[t>>0]=r+255|r;t=de[e>>2]|0;if(!(t&8)){de[e+8>>2]=0;de[e+4>>2]=0;t=de[e+44>>2]|0;de[e+28>>2]=t;de[e+20>>2]=t;de[e+16>>2]=t+(de[e+48>>2]|0);t=0}else{de[e>>2]=t|32;t=-1}return t|0}function Mr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;o=t&255;i=(r|0)!=0;e:do{if(i&(e&3|0)!=0){n=t&255;while(1){if((pe[e>>0]|0)==n<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;i=(r|0)!=0;if(!(i&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(i)a=6;else r=0;e:do{if((a|0)==6){n=t&255;if((pe[e>>0]|0)!=n<<24>>24){i=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=de[e>>2]^i;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((pe[e>>0]|0)==n<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Dr(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;t=e+20|0;o=e+28|0;if((de[t>>2]|0)>>>0>(de[o>>2]|0)>>>0?(Pi[de[e+36>>2]&7](e,0,0)|0,(de[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=de[a>>2]|0;i=e+8|0;n=de[i>>2]|0;if(r>>>0>>0)Pi[de[e+40>>2]&7](e,r-n|0,1)|0;de[e+16>>2]=0;de[o>>2]=0;de[t>>2]=0;de[i>>2]=0;de[a>>2]=0;t=0}return t|0}function Rr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0.0,h=0,c=0,f=0,p=0,d=0.0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0,j=0,N=0,B=0,U=0,X=0,H=0,W=0,q=0,G=0,V=0,Y=0,Z=0,J=0,K=0,Q=0;Q=ve;ve=ve+624|0;V=Q+24|0;Z=Q+16|0;Y=Q+588|0;X=Q+576|0;G=Q;N=Q+536|0;K=Q+8|0;J=Q+528|0;I=(e|0)!=0;O=N+40|0;j=O;N=N+39|0;B=K+4|0;U=X+12|0;X=X+11|0;H=Y;W=U;q=W-H|0;M=-2-H|0;D=W+2|0;R=V+288|0;z=Y+9|0;F=z;L=Y+8|0;o=0;m=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=hr()|0;de[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=pe[m>>0]|0;if(!(a<<24>>24)){A=245;break}else s=m;t:while(1){switch(a<<24>>24){case 37:{a=s;A=9;break t}case 0:{a=s;break t}default:{}}C=s+1|0;a=pe[C>>0]|0;s=C}t:do{if((A|0)==9)while(1){A=0;if((pe[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((pe[a>>0]|0)==37)A=9;else break}}while(0);v=s-m|0;if(I?(de[e>>2]&32|0)==0:0)_r(m,v,e)|0;if((s|0)!=(m|0)){m=a;a=v;continue}h=a+1|0;s=pe[h>>0]|0;l=(s<<24>>24)+-48|0;if(l>>>0<10){C=(pe[a+2>>0]|0)==36;h=C?a+3|0:h;s=pe[h>>0]|0;p=C?l:-1;t=C?1:t}else p=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){l=0;while(1){if(!(1<>24)+-32|l;h=h+1|0;s=pe[h>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){c=l;a=h;break}}}else{c=0;a=h}}while(0);do{if(s<<24>>24==42){l=a+1|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+2>>0]|0)==36:0){de[n+(s<<2)>>2]=10;t=1;a=a+3|0;s=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!I){g=c;a=l;t=0;C=0;break}t=(de[r>>2]|0)+(4-1)&~(4-1);s=de[t>>2]|0;de[r>>2]=t+4;t=0;a=l}if((s|0)<0){g=c|8192;C=0-s|0}else{g=c;C=s}}else{l=(s<<24>>24)+-48|0;if(l>>>0<10){s=0;do{s=(s*10|0)+l|0;a=a+1|0;l=(pe[a>>0]|0)+-48|0}while(l>>>0<10);if((s|0)<0){o=-1;break e}else{g=c;C=s}}else{g=c;C=0}}}while(0);t:do{if((pe[a>>0]|0)==46){l=a+1|0;s=pe[l>>0]|0;if(s<<24>>24!=42){h=(s<<24>>24)+-48|0;if(h>>>0<10){a=l;s=0}else{a=l;h=0;break}while(1){s=(s*10|0)+h|0;a=a+1|0;h=(pe[a>>0]|0)+-48|0;if(h>>>0>=10){h=s;break t}}}l=a+2|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+3>>0]|0)==36:0){de[n+(s<<2)>>2]=10;a=a+4|0;h=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(I){a=(de[r>>2]|0)+(4-1)&~(4-1);h=de[a>>2]|0;de[r>>2]=a+4;a=l}else{a=l;h=0}}else h=-1}while(0);f=0;while(1){s=(pe[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}l=a+1|0;s=pe[5359+(f*58|0)+s>>0]|0;c=s&255;if((c+-1|0)>>>0<8){a=l;f=c}else{E=l;break}}if(!(s<<24>>24)){o=-1;break}l=(p|0)>-1;do{if(s<<24>>24==19)if(l){o=-1;break e}else A=52;else{if(l){de[n+(p<<2)>>2]=c;S=i+(p<<3)|0;P=de[S+4>>2]|0;A=G;de[A>>2]=de[S>>2];de[A+4>>2]=P;A=52;break}if(!I){o=0;break e}Lr(G,c,r)}}while(0);if((A|0)==52?(A=0,!I):0){m=E;a=v;continue}p=pe[a>>0]|0;p=(f|0)!=0&(p&15|0)==3?p&-33:p;l=g&-65537;P=(g&8192|0)==0?g:l;t:do{switch(p|0){case 110:switch(f|0){case 0:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 1:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 2:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}case 3:{$[de[G>>2]>>1]=o;m=E;a=v;continue e}case 4:{pe[de[G>>2]>>0]=o;m=E;a=v;continue e}case 6:{de[de[G>>2]>>2]=o;m=E;a=v;continue e}case 7:{m=de[G>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}default:{m=E;a=v;continue e}}case 112:{f=P|8;h=h>>>0>8?h:8;p=120;A=64;break}case 88:case 120:{f=P;A=64;break}case 111:{l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;if((s|0)==0&(l|0)==0)a=O;else{a=O;do{a=a+-1|0;pe[a>>0]=s&7|48;s=Zr(s|0,l|0,3)|0;l=re}while(!((s|0)==0&(l|0)==0))}if(!(P&8)){s=P;f=0;c=5839;A=77}else{f=j-a+1|0;s=P;h=(h|0)<(f|0)?f:h;f=0;c=5839;A=77}break}case 105:case 100:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;if((s|0)<0){a=Vr(0,0,a|0,s|0)|0;s=re;l=G;de[l>>2]=a;de[l+4>>2]=s;l=1;c=5839;A=76;break t}if(!(P&2048)){c=P&1;l=c;c=(c|0)==0?5839:5841;A=76}else{l=1;c=5840;A=76}break}case 117:{s=G;a=de[s>>2]|0;s=de[s+4>>2]|0;l=0;c=5839;A=76;break}case 99:{pe[N>>0]=de[G>>2];m=N;s=1;f=0;p=5839;a=O;break}case 109:{a=hr()|0;a=ur(de[a>>2]|0)|0;A=82;break}case 115:{a=de[G>>2]|0;a=(a|0)!=0?a:5849;A=82;break}case 67:{de[K>>2]=de[G>>2];de[B>>2]=0;de[G>>2]=K;h=-1;A=86;break}case 83:{if(!h){Nr(e,32,C,0,P);a=0;A=98}else A=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[G>>3];de[Z>>2]=0;ee[te>>3]=u;if((de[te+4>>2]|0)>=0)if(!(P&2048)){S=P&1;k=S;S=(S|0)==0?5857:5862}else{k=1;S=5859}else{u=-u;k=1;S=5856}ee[te>>3]=u;T=de[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){d=+pr(u,Z)*2.0;s=d!=0.0;if(s)de[Z>>2]=(de[Z>>2]|0)+-1;x=p|32;if((x|0)==97){m=p&32;v=(m|0)==0?S:S+9|0;g=k|2;a=12-h|0;do{if(!(h>>>0>11|(a|0)==0)){u=8.0;do{a=a+-1|0;u=u*16.0}while((a|0)!=0);if((pe[v>>0]|0)==45){u=-(u+(-d-u));break}else{u=d+u-u;break}}else u=d}while(0);s=de[Z>>2]|0;a=(s|0)<0?0-s|0:s;a=jr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){pe[X>>0]=48;a=X}pe[a+-1>>0]=(s>>31&2)+43;f=a+-2|0;pe[f>>0]=p+15;c=(h|0)<1;l=(P&8|0)==0;s=Y;while(1){S=~~u;a=s+1|0;pe[s>>0]=me[5823+S>>0]|m;u=(u-+(S|0))*16.0;do{if((a-H|0)==1){if(l&(c&u==0.0))break;pe[a>>0]=46;a=s+2|0}}while(0);if(!(u!=0.0))break;else s=a}h=(h|0)!=0&(M+a|0)<(h|0)?D+h-f|0:q-f+a|0;l=h+g|0;Nr(e,32,C,l,P);if(!(de[e>>2]&32))_r(v,g,e)|0;Nr(e,48,C,l,P^65536);a=a-H|0;if(!(de[e>>2]&32))_r(Y,a,e)|0;s=W-f|0;Nr(e,48,h-(a+s)|0,0,0);if(!(de[e>>2]&32))_r(f,s,e)|0;Nr(e,32,C,l,P^8192);a=(l|0)<(C|0)?C:l;break}a=(h|0)<0?6:h;if(s){s=(de[Z>>2]|0)+-28|0;de[Z>>2]=s;u=d*268435456.0}else{u=d;s=de[Z>>2]|0}T=(s|0)<0?V:R;w=T;s=T;do{b=~~u>>>0;de[s>>2]=b;s=s+4|0;u=(u-+(b>>>0))*1.0e9}while(u!=0.0);l=s;s=de[Z>>2]|0;if((s|0)>0){c=T;while(1){f=(s|0)>29?29:s;h=l+-4|0;do{if(h>>>0>>0)h=c;else{s=0;do{b=Jr(de[h>>2]|0,0,f|0)|0;b=Kr(b|0,re|0,s|0,0)|0;s=re;y=ai(b|0,s|0,1e9,0)|0;de[h>>2]=y;s=oi(b|0,s|0,1e9,0)|0;h=h+-4|0}while(h>>>0>=c>>>0);if(!s){h=c;break}h=c+-4|0;de[h>>2]=s}}while(0);while(1){if(l>>>0<=h>>>0)break;s=l+-4|0;if(!(de[s>>2]|0))l=s;else break}s=(de[Z>>2]|0)-f|0;de[Z>>2]=s;if((s|0)>0)c=h;else break}}else h=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;m=h;while(1){g=0-s|0;g=(g|0)>9?9:g;do{if(m>>>0>>0){s=(1<>>g;h=0;f=m;do{b=de[f>>2]|0;de[f>>2]=(b>>>g)+h;h=_e(b&s,c)|0;f=f+4|0}while(f>>>0>>0);s=(de[m>>2]|0)==0?m+4|0:m;if(!h){h=s;break}de[l>>2]=h;h=s;l=l+4|0}else h=(de[m>>2]|0)==0?m+4|0:m}while(0);s=_?T:h;l=(l-s>>2|0)>(v|0)?s+(v<<2)|0:l;s=(de[Z>>2]|0)+g|0;de[Z>>2]=s;if((s|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){s=(w-m>>2)*9|0;c=de[m>>2]|0;if(c>>>0<10)break;else h=10;do{h=h*10|0;s=s+1|0}while(c>>>0>=h>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;h=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((h|0)<(((l-w>>2)*9|0)+-9|0)){f=h+9216|0;_=(f|0)/9|0;h=T+(_+-1023<<2)|0;f=((f|0)%9|0)+1|0;if((f|0)<9){c=10;do{c=c*10|0;f=f+1|0}while((f|0)!=9)}else c=10;g=de[h>>2]|0;v=(g>>>0)%(c>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(l|0):0)c=m;else A=163;do{if((A|0)==163){A=0;d=(((g>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;f=(c|0)/2|0;do{if(v>>>0>>0)u=.5;else{if((v|0)==(f|0)?(T+(_+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(k){if((pe[S>>0]|0)!=45)break;d=-d;u=-u}}while(0);f=g-v|0;de[h>>2]=f;if(!(d+u!=d)){c=m;break}x=f+c|0;de[h>>2]=x;if(x>>>0>999999999){s=m;while(1){c=h+-4|0;de[h>>2]=0;if(c>>>0>>0){s=s+-4|0;de[s>>2]=0}x=(de[c>>2]|0)+1|0;de[c>>2]=x;if(x>>>0>999999999)h=c;else{m=s;h=c;break}}}s=(w-m>>2)*9|0;f=de[m>>2]|0;if(f>>>0<10){c=m;break}else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0);c=m}}while(0);x=h+4|0;m=c;l=l>>>0>x>>>0?x:l}v=0-s|0;while(1){if(l>>>0<=m>>>0){_=0;x=l;break}h=l+-4|0;if(!(de[h>>2]|0))l=h;else{_=1;x=l;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){p=p+-1|0;a=a+-1-s|0}else{p=p+-2|0;a=a+-1|0}l=P&8;if(l)break;do{if(_){l=de[x+-4>>2]|0;if(!l){h=9;break}if(!((l>>>0)%10|0)){c=10;h=0}else{h=0;break}do{c=c*10|0;h=h+1|0}while(((l>>>0)%(c>>>0)|0|0)==0)}else h=9}while(0);l=((x-w>>2)*9|0)+-9|0;if((p|32|0)==102){l=l-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}else{l=l+s-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}}else l=P&8}while(0);g=a|l;c=(g|0)!=0&1;f=(p|32|0)==102;if(f){s=(s|0)>0?s:0;p=0}else{h=(s|0)<0?v:s;h=jr(h,((h|0)<0)<<31>>31,U)|0;if((W-h|0)<2)do{h=h+-1|0;pe[h>>0]=48}while((W-h|0)<2);pe[h+-1>>0]=(s>>31&2)+43;w=h+-2|0;pe[w>>0]=p;s=W-w|0;p=w}v=k+1+a+c+s|0;Nr(e,32,C,v,P);if(!(de[e>>2]&32))_r(S,k,e)|0;Nr(e,48,C,v,P^65536);do{if(f){h=m>>>0>T>>>0?T:m;s=h;do{l=jr(de[s>>2]|0,0,z)|0;do{if((s|0)==(h|0)){if((l|0)!=(z|0))break;pe[L>>0]=48;l=L}else{if(l>>>0<=Y>>>0)break;do{l=l+-1|0;pe[l>>0]=48}while(l>>>0>Y>>>0)}}while(0);if(!(de[e>>2]&32))_r(l,F-l|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(g){if(de[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){l=s;while(1){s=jr(de[l>>2]|0,0,z)|0;if(s>>>0>Y>>>0)do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0);if(!(de[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;l=l+4|0;s=a+-9|0;if(!((a|0)>9&l>>>0>>0)){a=s;break}else a=s}}Nr(e,48,a+9|0,9,0)}else{f=_?x:m+4|0;if((a|0)>-1){c=(l|0)==0;h=m;do{s=jr(de[h>>2]|0,0,z)|0;if((s|0)==(z|0)){pe[L>>0]=48;s=L}do{if((h|0)==(m|0)){l=s+1|0;if(!(de[e>>2]&32))_r(s,1,e)|0;if(c&(a|0)<1){s=l;break}if(de[e>>2]&32){s=l;break}_r(5891,1,e)|0;s=l}else{if(s>>>0<=Y>>>0)break;do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0)}}while(0);l=F-s|0;if(!(de[e>>2]&32))_r(s,(a|0)>(l|0)?l:a,e)|0;a=a-l|0;h=h+4|0}while(h>>>0>>0&(a|0)>-1)}Nr(e,48,a+18|0,18,0);if(de[e>>2]&32)break;_r(p,W-p|0,e)|0}}while(0);Nr(e,32,C,v,P^8192);a=(v|0)<(C|0)?C:v}else{f=(p&32|0)!=0;c=u!=u|0.0!=0.0;s=c?0:k;h=s+3|0;Nr(e,32,C,h,l);a=de[e>>2]|0;if(!(a&32)){_r(S,s,e)|0;a=de[e>>2]|0}if(!(a&32))_r(c?f?5883:5887:f?5875:5879,3,e)|0;Nr(e,32,C,h,P^8192);a=(h|0)<(C|0)?C:h}}while(0);m=E;continue e}default:{l=P;s=h;f=0;p=5839;a=O}}}while(0);t:do{if((A|0)==64){l=G;s=de[l>>2]|0;l=de[l+4>>2]|0;c=p&32;if(!((s|0)==0&(l|0)==0)){a=O;do{a=a+-1|0;pe[a>>0]=me[5823+(s&15)>>0]|c;s=Zr(s|0,l|0,4)|0;l=re}while(!((s|0)==0&(l|0)==0));A=G;if((f&8|0)==0|(de[A>>2]|0)==0&(de[A+4>>2]|0)==0){s=f;f=0;c=5839;A=77}else{s=f;f=2;c=5839+(p>>4)|0;A=77}}else{a=O;s=f;f=0;c=5839;A=77}}else if((A|0)==76){a=jr(a,s,O)|0;s=P;f=l;A=77}else if((A|0)==82){A=0;P=Mr(a,0,h)|0;S=(P|0)==0;m=a;s=S?h:P-a|0;f=0;p=5839;a=S?a+h|0:P}else if((A|0)==86){A=0;s=0;a=0;c=de[G>>2]|0;while(1){l=de[c>>2]|0;if(!l)break;a=mr(J,l)|0;if((a|0)<0|a>>>0>(h-s|0)>>>0)break;s=a+s|0;if(h>>>0>s>>>0)c=c+4|0;else break}if((a|0)<0){o=-1;break e}Nr(e,32,C,s,P);if(!s){a=0;A=98}else{l=0;h=de[G>>2]|0;while(1){a=de[h>>2]|0;if(!a){a=s;A=98;break t}a=mr(J,a)|0;l=a+l|0;if((l|0)>(s|0)){a=s;A=98;break t}if(!(de[e>>2]&32))_r(J,a,e)|0;if(l>>>0>=s>>>0){a=s;A=98;break}else h=h+4|0}}}}while(0);if((A|0)==98){A=0;Nr(e,32,C,a,P^8192);m=E;a=(C|0)>(a|0)?C:a;continue}if((A|0)==77){A=0;l=(h|0)>-1?s&-65537:s;s=G;s=(de[s>>2]|0)!=0|(de[s+4>>2]|0)!=0;if((h|0)!=0|s){s=(s&1^1)+(j-a)|0;m=a;s=(h|0)>(s|0)?h:s;p=c;a=O}else{m=O;s=0;p=c;a=O}}c=a-m|0;s=(s|0)<(c|0)?c:s;h=f+s|0;a=(C|0)<(h|0)?h:C;Nr(e,32,a,h,l);if(!(de[e>>2]&32))_r(p,f,e)|0;Nr(e,48,a,h,l^65536);Nr(e,48,s,c,0);if(!(de[e>>2]&32))_r(m,c,e)|0;Nr(e,32,a,h,l^8192);m=E}e:do{if((A|0)==245)if(!e)if(t){o=1;while(1){t=de[n+(o<<2)>>2]|0;if(!t)break;Lr(i+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(de[n+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=Q;return o|0}function zr(e){e=e|0;if(!(de[e+68>>2]|0))Sr(e);return}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=e+20|0;n=de[i>>2]|0;e=(de[e+16>>2]|0)-n|0;e=e>>>0>r>>>0?r:e;Qr(n|0,t|0,e|0)|0;de[i>>2]=(de[i>>2]|0)+e;return r|0}function Lr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;de[e>>2]=t;break e}case 10:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=0;break e}case 12:{i=(de[r>>2]|0)+(8-1)&~(8-1);t=i;n=de[t>>2]|0;t=de[t+4>>2]|0;de[r>>2]=i+8;i=e;de[i>>2]=n;de[i+4>>2]=t;break e}case 13:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&65535)<<16>>16;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 14:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&65535;de[n+4>>2]=0;break e}case 15:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&255)<<24>>24;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 16:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&255;de[n+4>>2]=0;break e}case 17:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}case 18:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){i=ai(e|0,t|0,10,0)|0;r=r+-1|0;pe[r>>0]=i|48;i=oi(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=i;t=re}else{e=i;break}}if(e)while(1){r=r+-1|0;pe[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Nr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(i|0)&(n&73728|0)==0){n=r-i|0;Yr(a|0,t|0,(n>>>0>256?256:n)|0)|0;t=de[e>>2]|0;o=(t&32|0)==0;if(n>>>0>255){i=r-i|0;do{if(o){_r(a,256,e)|0;t=de[e>>2]|0}n=n+-256|0;o=(t&32|0)==0}while(n>>>0>255);if(o)n=i&255;else break}else if(!o)break;_r(a,n,e)|0}}while(0);ve=s;return}function Br(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,S=0,P=0,E=0,C=0,A=0,I=0,O=0,M=0,D=0,R=0,z=0,F=0,L=0;do{if(e>>>0<245){p=e>>>0<11?16:e+11&-8;e=p>>>3;s=de[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;n=de[i>>2]|0;o=n+8|0;a=de[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(de[155]|0)>>>0)Xe();t=a+12|0;if((de[t>>2]|0)==(n|0)){de[t>>2]=r;de[i>>2]=a;break}else Xe()}else de[151]=s&~(1<>2]=L|3;L=n+(L|4)|0;de[L>>2]=de[L>>2]|1;L=o;return L|0}a=de[153]|0;if(p>>>0>a>>>0){if(r){i=2<>>12&16;i=i>>>l;n=i>>>5&8;i=i>>>n;o=i>>>2&4;i=i>>>o;r=i>>>1&2;i=i>>>r;e=i>>>1&1;e=(n|l|o|r|e)+(i>>>e)|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;o=de[i>>2]|0;l=o+8|0;n=de[l>>2]|0;do{if((r|0)!=(n|0)){if(n>>>0<(de[155]|0)>>>0)Xe();t=n+12|0;if((de[t>>2]|0)==(o|0)){de[t>>2]=r;de[i>>2]=n;u=de[153]|0;break}else Xe()}else{de[151]=s&~(1<>2]=p|3;s=o+p|0;de[o+(p|4)>>2]=a|1;de[o+L>>2]=a;if(u){n=de[156]|0;r=u>>>3;t=r<<1;i=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(t>>>0<(de[155]|0)>>>0)Xe();else{h=e;c=t}}else{de[151]=e|r;h=644+(t+2<<2)|0;c=i}de[h>>2]=n;de[c+12>>2]=n;de[n+8>>2]=c;de[n+12>>2]=i}de[153]=a;de[156]=s;L=l;return L|0}e=de[152]|0;if(e){r=(e&0-e)+-1|0;F=r>>>12&16;r=r>>>F;z=r>>>5&8;r=r>>>z;L=r>>>2&4;r=r>>>L;e=r>>>1&2;r=r>>>e;i=r>>>1&1;i=de[908+((z|F|L|e|i)+(r>>>i)<<2)>>2]|0;r=(de[i+4>>2]&-8)-p|0;e=i;while(1){t=de[e+16>>2]|0;if(!t){t=de[e+20>>2]|0;if(!t){l=r;break}}e=(de[t+4>>2]&-8)-p|0;L=e>>>0>>0;r=L?e:r;e=t;i=L?t:i}o=de[155]|0;if(i>>>0>>0)Xe();s=i+p|0;if(i>>>0>=s>>>0)Xe();a=de[i+24>>2]|0;r=de[i+12>>2]|0;do{if((r|0)==(i|0)){e=i+20|0;t=de[e>>2]|0;if(!t){e=i+16|0;t=de[e>>2]|0;if(!t){f=0;break}}while(1){r=t+20|0;n=de[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=de[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{de[e>>2]=0;f=t;break}}else{n=de[i+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(i|0))Xe();e=r+8|0;if((de[e>>2]|0)==(i|0)){de[t>>2]=r;de[e>>2]=n;f=r;break}else Xe()}}while(0);do{if(a){t=de[i+28>>2]|0;e=908+(t<<2)|0;if((i|0)==(de[e>>2]|0)){de[e>>2]=f;if(!f){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(i|0))de[t>>2]=f;else de[a+20>>2]=f;if(!f)break}e=de[155]|0;if(f>>>0>>0)Xe();de[f+24>>2]=a;t=de[i+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[f+16>>2]=t;de[t+24>>2]=f;break}}while(0);t=de[i+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[f+20>>2]=t;de[t+24>>2]=f;break}}}while(0);if(l>>>0<16){L=l+p|0;de[i+4>>2]=L|3;L=i+(L+4)|0;de[L>>2]=de[L>>2]|1}else{de[i+4>>2]=p|3;de[i+(p|4)>>2]=l|1;de[i+(l+p)>>2]=l;t=de[153]|0;if(t){o=de[156]|0;r=t>>>3;t=r<<1;n=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{d=t;m=e}}else{de[151]=e|r;d=644+(t+2<<2)|0;m=n}de[d>>2]=o;de[m+12>>2]=o;de[o+8>>2]=m;de[o+12>>2]=n}de[153]=l;de[156]=s}L=i+8|0;return L|0}else m=p}else m=p}else if(e>>>0<=4294967231){e=e+11|0;c=e&-8;h=de[152]|0;if(h){r=0-c|0;e=e>>>8;if(e)if(c>>>0>16777215)u=31;else{m=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;u=14-(d|m|u)+(b<>>15)|0;u=c>>>(u+7|0)&1|u<<1}else u=0;e=de[908+(u<<2)>>2]|0;e:do{if(!e){n=0;e=0;b=86}else{a=r;n=0;s=c<<((u|0)==31?0:25-(u>>>1)|0);l=e;e=0;while(1){o=de[l+4>>2]&-8;r=o-c|0;if(r>>>0>>0)if((o|0)==(c|0)){o=l;e=l;b=90;break e}else e=l;else r=a;b=de[l+20>>2]|0;l=de[l+16+(s>>>31<<2)>>2]|0;n=(b|0)==0|(b|0)==(l|0)?n:b;if(!l){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((n|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>f;h=e>>>5&8;e=e>>>h;d=e>>>2&4;e=e>>>d;m=e>>>1&2;e=e>>>m;n=e>>>1&1;n=de[908+((h|f|d|m|n)+(e>>>n)<<2)>>2]|0;e=0}if(!n){s=r;l=e}else{o=n;b=90}}if((b|0)==90)while(1){b=0;m=(de[o+4>>2]&-8)-c|0;n=m>>>0>>0;r=n?m:r;e=n?o:e;n=de[o+16>>2]|0;if(n){o=n;b=90;continue}o=de[o+20>>2]|0;if(!o){s=r;l=e;break}else b=90}if((l|0)!=0?s>>>0<((de[153]|0)-c|0)>>>0:0){n=de[155]|0;if(l>>>0>>0)Xe();a=l+c|0;if(l>>>0>=a>>>0)Xe();o=de[l+24>>2]|0;r=de[l+12>>2]|0;do{if((r|0)==(l|0)){e=l+20|0;t=de[e>>2]|0;if(!t){e=l+16|0;t=de[e>>2]|0;if(!t){p=0;break}}while(1){r=t+20|0;i=de[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=de[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{de[e>>2]=0;p=t;break}}else{i=de[l+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((de[t>>2]|0)!=(l|0))Xe();e=r+8|0;if((de[e>>2]|0)==(l|0)){de[t>>2]=r;de[e>>2]=i;p=r;break}else Xe()}}while(0);do{if(o){t=de[l+28>>2]|0;e=908+(t<<2)|0;if((l|0)==(de[e>>2]|0)){de[e>>2]=p;if(!p){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=o+16|0;if((de[t>>2]|0)==(l|0))de[t>>2]=p;else de[o+20>>2]=p;if(!p)break}e=de[155]|0;if(p>>>0>>0)Xe();de[p+24>>2]=o;t=de[l+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[p+16>>2]=t;de[t+24>>2]=p;break}}while(0);t=de[l+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[p+20>>2]=t;de[t+24>>2]=p;break}}}while(0);e:do{if(s>>>0>=16){de[l+4>>2]=c|3;de[l+(c|4)>>2]=s|1;de[l+(s+c)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{v=t;_=e}}else{de[151]=r|t;v=644+(e+2<<2)|0;_=i}de[v>>2]=a;de[_+12>>2]=a;de[l+(c+8)>>2]=_;de[l+(c+12)>>2]=i;break}t=s>>>8;if(t)if(s>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|i)+(L<>>15)|0;i=s>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;de[l+(c+28)>>2]=i;de[l+(c+20)>>2]=0;de[l+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break}t=de[t>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(s|0)){i=s<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&T>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[l+(c+8)>>2]=e;de[l+(c+12)>>2]=T;de[l+(c+24)>>2]=0;break}else Xe()}else{L=s+c|0;de[l+4>>2]=L|3;L=l+(L+4)|0;de[L>>2]=de[L>>2]|1}}while(0);L=l+8|0;return L|0}else m=c}else m=c}else m=-1}while(0);r=de[153]|0;if(r>>>0>=m>>>0){t=r-m|0;e=de[156]|0;if(t>>>0>15){de[156]=e+m;de[153]=t;de[e+(m+4)>>2]=t|1;de[e+r>>2]=t;de[e+4>>2]=m|3}else{de[153]=0;de[156]=0;de[e+4>>2]=r|3;L=e+(r+4)|0;de[L>>2]=de[L>>2]|1}L=e+8|0;return L|0}e=de[154]|0;if(e>>>0>m>>>0){F=e-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}do{if(!(de[269]|0)){e=De(30)|0;if(!(e+-1&e)){de[271]=e;de[270]=e;de[272]=-1;de[273]=-1;de[274]=0;de[262]=0;T=(We(0)|0)&-16^1431655768;de[269]=T;break}else Xe()}}while(0);l=m+48|0;s=de[271]|0;u=m+47|0;a=s+u|0;s=0-s|0;h=a&s;if(h>>>0<=m>>>0){L=0;return L|0}e=de[261]|0;if((e|0)!=0?(_=de[259]|0,T=_+h|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){L=0;return L|0}e:do{if(!(de[262]&4)){e=de[157]|0;t:do{if(e){n=1052;while(1){r=de[n>>2]|0;if(r>>>0<=e>>>0?(g=n+4|0,(r+(de[g>>2]|0)|0)>>>0>e>>>0):0){o=n;e=g;break}n=de[n+8>>2]|0;if(!n){b=174;break t}}r=a-(de[154]|0)&s;if(r>>>0<2147483647){n=Ie(r|0)|0;T=(n|0)==((de[o>>2]|0)+(de[e>>2]|0)|0);e=T?r:0;if(T){if((n|0)!=(-1|0)){x=n;d=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ie(0)|0;if((o|0)!=(-1|0)){e=o;r=de[270]|0;n=r+-1|0;if(!(n&e))r=h;else r=h-e+(n+e&0-r)|0;e=de[259]|0;n=e+r|0;if(r>>>0>m>>>0&r>>>0<2147483647){T=de[261]|0;if((T|0)!=0?n>>>0<=e>>>0|n>>>0>T>>>0:0){e=0;break}n=Ie(r|0)|0;T=(n|0)==(o|0);e=T?r:0;if(T){x=o;d=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(l>>>0>r>>>0&(r>>>0<2147483647&(n|0)!=(-1|0))?(y=de[271]|0,y=u-r+y&0-y,y>>>0<2147483647):0)if((Ie(y|0)|0)==(-1|0)){Ie(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((n|0)!=(-1|0)){x=n;d=r;b=194;break e}}}while(0);de[262]=de[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?h>>>0<2147483647:0)?(x=Ie(h|0)|0,w=Ie(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(k=w-x|0,S=k>>>0>(m+40|0)>>>0,S):0){d=S?k:e;b=194}if((b|0)==194){e=(de[259]|0)+d|0;de[259]=e;if(e>>>0>(de[260]|0)>>>0)de[260]=e;a=de[157]|0;e:do{if(a){o=1052;do{e=de[o>>2]|0;r=o+4|0;n=de[r>>2]|0;if((x|0)==(e+n|0)){P=e;E=r;C=n;A=o;b=204;break}o=de[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(de[A+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=P>>>0:0){de[E>>2]=C+d;L=(de[154]|0)+d|0;F=a+8|0;F=(F&7|0)==0?0:0-F&7;z=L-F|0;de[157]=a+F;de[154]=z;de[a+(F+4)>>2]=z|1;de[a+(L+4)>>2]=40;de[158]=de[273];break}e=de[155]|0;if(x>>>0>>0){de[155]=x;e=x}r=x+d|0;o=1052;while(1){if((de[o>>2]|0)==(r|0)){n=o;r=o;b=212;break}o=de[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(de[r+12>>2]&8)){de[n>>2]=x;f=r+4|0;de[f>>2]=(de[f>>2]|0)+d;f=x+8|0;f=(f&7|0)==0?0:0-f&7;u=x+(d+8)|0;u=(u&7|0)==0?0:0-u&7;t=x+(u+d)|0;c=f+m|0;p=x+c|0;h=t-(x+f)-m|0;de[x+(f+4)>>2]=m|3;t:do{if((t|0)!=(a|0)){if((t|0)==(de[156]|0)){L=(de[153]|0)+h|0;de[153]=L;de[156]=p;de[x+(c+4)>>2]=L|1;de[x+(L+c)>>2]=L;break}s=d+4|0;r=de[x+(s+u)>>2]|0;if((r&3|0)==1){l=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=de[x+((u|24)+d)>>2]|0;i=de[x+(d+12+u)>>2]|0;do{if((i|0)==(t|0)){n=u|16;i=x+(s+n)|0;r=de[i>>2]|0;if(!r){i=x+(n+d)|0;r=de[i>>2]|0;if(!r){R=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;R=r;break}}else{n=de[x+((u|8)+d)>>2]|0;if(n>>>0>>0)Xe();e=n+12|0;if((de[e>>2]|0)!=(t|0))Xe();r=i+8|0;if((de[r>>2]|0)==(t|0)){de[e>>2]=i;de[r>>2]=n;R=i;break}else Xe()}}while(0);if(!a)break;e=de[x+(d+28+u)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(de[r>>2]|0)){if(a>>>0<(de[155]|0)>>>0)Xe();e=a+16|0;if((de[e>>2]|0)==(t|0))de[e>>2]=R;else de[a+20>>2]=R;if(!R)break r}else{de[r>>2]=R;if(R)break;de[152]=de[152]&~(1<>>0>>0)Xe();de[R+24>>2]=a;t=u|16;e=de[x+(t+d)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{de[R+16>>2]=e;de[e+24>>2]=R;break}}while(0);t=de[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(de[155]|0)>>>0)Xe();else{de[R+20>>2]=t;de[t+24>>2]=R;break}}else{i=de[x+((u|8)+d)>>2]|0;n=de[x+(d+12+u)>>2]|0;r=644+(o<<1<<2)|0;do{if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((de[i+12>>2]|0)==(t|0))break;Xe()}}while(0);if((n|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();e=n+8|0;if((de[e>>2]|0)==(t|0)){I=e;break}Xe()}}while(0);de[i+12>>2]=n;de[I>>2]=i}}while(0);t=x+((l|u)+d)|0;n=l+h|0}else n=h;t=t+4|0;de[t>>2]=de[t>>2]&-2;de[x+(c+4)>>2]=n|1;de[x+(n+c)>>2]=n;t=n>>>3;if(n>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0>=(de[155]|0)>>>0){z=t;F=e;break}Xe()}}while(0);de[z>>2]=p;de[F+12>>2]=p;de[x+(c+8)>>2]=F;de[x+(c+12)>>2]=i;break}t=n>>>8;do{if(!t)i=0;else{if(n>>>0>16777215){i=31;break}z=(t+1048320|0)>>>16&8;F=t<>>16&4;F=F<>>16&2;i=14-(R|z|i)+(F<>>15)|0;i=n>>>(i+7|0)&1|i<<1}}while(0);t=908+(i<<2)|0;de[x+(c+28)>>2]=i;de[x+(c+20)>>2]=0;de[x+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break}t=de[t>>2]|0;r:do{if((de[t+4>>2]&-8|0)!=(n|0)){i=n<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(n|0)){L=r;break r}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break t}}else L=t}while(0);t=L+8|0;e=de[t>>2]|0;F=de[155]|0;if(e>>>0>=F>>>0&L>>>0>=F>>>0){de[e+12>>2]=p;de[t>>2]=p;de[x+(c+8)>>2]=e;de[x+(c+12)>>2]=L;de[x+(c+24)>>2]=0;break}else Xe()}else{L=(de[154]|0)+h|0;de[154]=L;de[157]=p;de[x+(c+4)>>2]=L|1}}while(0);L=x+(f|8)|0;return L|0}else r=1052;while(1){e=de[r>>2]|0;if(e>>>0<=a>>>0?(t=de[r+4>>2]|0,i=e+t|0,i>>>0>a>>>0):0)break;r=de[r+8>>2]|0}n=e+(t+-39)|0;e=e+(t+-47+((n&7|0)==0?0:0-n&7))|0;n=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;L=d+-40-r|0;de[157]=x+r;de[154]=L;de[x+(r+4)>>2]=L|1;de[x+(d+-36)>>2]=40;de[158]=de[273];r=e+4|0;de[r>>2]=27;de[t>>2]=de[263];de[t+4>>2]=de[264];de[t+8>>2]=de[265];de[t+12>>2]=de[266];de[263]=x;de[264]=d;de[266]=0;de[265]=t;t=e+28|0;de[t>>2]=7;if((e+32|0)>>>0>>0)do{L=t;t=t+4|0;de[t>>2]=7}while((L+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;de[r>>2]=de[r>>2]&-2;de[a+4>>2]=o|1;de[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{O=t;M=e}}else{de[151]=r|t;O=644+(e+2<<2)|0;M=i}de[O>>2]=a;de[M+12>>2]=a;de[a+8>>2]=M;de[a+12>>2]=i;break}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{F=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(z|F|i)+(L<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;r=908+(i<<2)|0;de[a+28>>2]=i;de[a+20>>2]=0;de[n>>2]=0;t=de[152]|0;e=1<>2]=a;de[a+24>>2]=r;de[a+12>>2]=a;de[a+8>>2]=a;break}t=de[r>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(o|0)){D=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[a+24>>2]=t;de[a+12>>2]=a;de[a+8>>2]=a;break e}}else D=t}while(0);t=D+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&D>>>0>=L>>>0){de[e+12>>2]=a;de[t>>2]=a;de[a+8>>2]=e;de[a+12>>2]=D;de[a+24>>2]=0;break}else Xe()}}else{L=de[155]|0;if((L|0)==0|x>>>0>>0)de[155]=x;de[263]=x;de[264]=d;de[266]=0;de[160]=de[269];de[159]=-1;t=0;do{L=t<<1;F=644+(L<<2)|0;de[644+(L+3<<2)>>2]=F;de[644+(L+2<<2)>>2]=F;t=t+1|0}while((t|0)!=32);L=x+8|0;L=(L&7|0)==0?0:0-L&7;F=d+-40-L|0;de[157]=x+L;de[154]=F;de[x+(L+4)>>2]=F|1;de[x+(d+-36)>>2]=40;de[158]=de[273]}}while(0);t=de[154]|0;if(t>>>0>m>>>0){F=t-m|0;de[154]=F;L=de[157]|0;de[157]=L+m;de[L+(m+4)>>2]=F|1;de[L+4>>2]=m|3;L=L+8|0;return L|0}}L=hr()|0;de[L>>2]=12;L=0;return L|0}function Ur(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=de[155]|0;if(t>>>0>>0)Xe();r=de[e+-4>>2]|0;i=r&3;if((i|0)==1)Xe();p=r&-8;m=e+(p+-8)|0;do{if(!(r&1)){t=de[t>>2]|0;if(!i)return;l=-8-t|0;h=e+l|0;c=t+p|0;if(h>>>0>>0)Xe();if((h|0)==(de[156]|0)){t=e+(p+-4)|0;r=de[t>>2]|0;if((r&3|0)!=3){y=h;o=c;break}de[153]=c;de[t>>2]=r&-2;de[e+(l+4)>>2]=c|1;de[m>>2]=c;return}n=t>>>3;if(t>>>0<256){i=de[e+(l+8)>>2]|0;r=de[e+(l+12)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0>>0)Xe();if((de[i+12>>2]|0)!=(h|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(h|0))a=t;else Xe()}else a=r+8|0;de[i+12>>2]=r;de[a>>2]=i;y=h;o=c;break}a=de[e+(l+24)>>2]|0;i=de[e+(l+12)>>2]|0;do{if((i|0)==(h|0)){r=e+(l+20)|0;t=de[r>>2]|0;if(!t){r=e+(l+16)|0;t=de[r>>2]|0;if(!t){u=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0>>0)Xe();else{de[r>>2]=0;u=t;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(h|0))Xe();r=i+8|0;if((de[r>>2]|0)==(h|0)){de[t>>2]=i;de[r>>2]=n;u=i;break}else Xe()}}while(0);if(a){t=de[e+(l+28)>>2]|0;r=908+(t<<2)|0;if((h|0)==(de[r>>2]|0)){de[r>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(h|0))de[t>>2]=u;else de[a+20>>2]=u;if(!u){y=h;o=c;break}}r=de[155]|0;if(u>>>0>>0)Xe();de[u+24>>2]=a;t=de[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[u+16>>2]=t;de[t+24>>2]=u;break}}while(0);t=de[e+(l+20)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[u+20>>2]=t;de[t+24>>2]=u;y=h;o=c;break}else{y=h;o=c}}else{y=h;o=c}}else{y=t;o=p}}while(0);if(y>>>0>=m>>>0)Xe();t=e+(p+-4)|0;r=de[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((m|0)==(de[157]|0)){_=(de[154]|0)+o|0;de[154]=_;de[157]=y;de[y+4>>2]=_|1;if((y|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){_=(de[153]|0)+o|0;de[153]=_;de[156]=y;de[y+4>>2]=_|1;de[y+_>>2]=_;return}o=(r&-8)+o|0;n=r>>>3;do{if(r>>>0>=256){a=de[e+(p+16)>>2]|0;t=de[e+(p|4)>>2]|0;do{if((t|0)==(m|0)){r=e+(p+12)|0;t=de[r>>2]|0;if(!t){r=e+(p+8)|0;t=de[r>>2]|0;if(!t){d=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=0;d=t;break}}else{r=de[e+p>>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();i=r+12|0;if((de[i>>2]|0)!=(m|0))Xe();n=t+8|0;if((de[n>>2]|0)==(m|0)){de[i>>2]=t;de[n>>2]=r;d=t;break}else Xe()}}while(0);if(a){t=de[e+(p+20)>>2]|0;r=908+(t<<2)|0;if((m|0)==(de[r>>2]|0)){de[r>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(m|0))de[t>>2]=d;else de[a+20>>2]=d;if(!d)break}r=de[155]|0;if(d>>>0>>0)Xe();de[d+24>>2]=a;t=de[e+(p+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[d+16>>2]=t;de[t+24>>2]=d;break}}while(0);t=de[e+(p+12)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[d+20>>2]=t;de[t+24>>2]=d;break}}}else{i=de[e+p>>2]|0;r=de[e+(p|4)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0<(de[155]|0)>>>0)Xe();if((de[i+12>>2]|0)!=(m|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0<(de[155]|0)>>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(m|0))f=t;else Xe()}else f=r+8|0;de[i+12>>2]=r;de[f>>2]=i}}while(0);de[y+4>>2]=o|1;de[y+o>>2]=o;if((y|0)==(de[156]|0)){de[153]=o;return}}else{de[t>>2]=r&-2;de[y+4>>2]=o|1;de[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;n=644+(r<<2)|0;i=de[151]|0;t=1<>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();else{g=t;v=r}}else{de[151]=i|t;g=644+(r+2<<2)|0;v=n}de[g>>2]=y;de[v+12>>2]=y;de[y+8>>2]=v;de[y+12>>2]=n;return}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{g=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;n=14-(m|g|n)+(v<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;de[y+28>>2]=n;de[y+20>>2]=0;de[y+16>>2]=0;r=de[152]|0;i=1<>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){r=t+16+(n>>>31<<2)|0;i=de[r>>2]|0;if(!i)break;if((de[i+4>>2]&-8|0)==(o|0)){_=i;break t}else{n=n<<1;t=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=de[t>>2]|0;v=de[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){de[r+12>>2]=y;de[t>>2]=y;de[y+8>>2]=r;de[y+12>>2]=_;de[y+24>>2]=0;break}else Xe()}else{de[152]=r|i;de[t>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y}}while(0);y=(de[159]|0)+-1|0;de[159]=y;if(!y)t=1060;else return;while(1){t=de[t>>2]|0;if(!t)break;else t=t+8|0}de[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,i=0;if(!e){e=Br(t)|0;return e|0}if(t>>>0>4294967231){e=hr()|0;de[e>>2]=12;e=0;return e|0}r=Wr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=Br(t)|0;if(!r){e=0;return e|0}i=de[e+-4>>2]|0;i=(i&-8)-((i&3|0)==0?8:4)|0;Qr(r|0,e|0,(i>>>0>>0?i:t)|0)|0;Ur(e);e=r;return e|0}function Hr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=de[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Wr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=e+4|0;d=de[p>>2]|0;l=d&-8;h=e+l|0;s=de[155]|0;r=d&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();i=e+(l|4)|0;n=de[i>>2]|0;if(!(n&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(l>>>0>=(t+4|0)>>>0?(l-t|0)>>>0<=de[271]<<1>>>0:0)return e|0;e=0;return e|0}if(l>>>0>=t>>>0){r=l-t|0;if(r>>>0<=15)return e|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|3;de[i>>2]=de[i>>2]|1;qr(e+t|0,r);return e|0}if((h|0)==(de[157]|0)){r=(de[154]|0)+l|0;if(r>>>0<=t>>>0){e=0;return e|0}f=r-t|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|1;de[157]=e+t;de[154]=f;return e|0}if((h|0)==(de[156]|0)){i=(de[153]|0)+l|0;if(i>>>0>>0){e=0;return e|0}r=i-t|0;if(r>>>0>15){de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|1;de[e+i>>2]=r;i=e+(i+4)|0;de[i>>2]=de[i>>2]&-2;i=e+t|0}else{de[p>>2]=d&1|i|2;i=e+(i+4)|0;de[i>>2]=de[i>>2]|1;i=0;r=0}de[153]=r;de[156]=i;return e|0}if(n&2){e=0;return e|0}c=(n&-8)+l|0;if(c>>>0>>0){e=0;return e|0}f=c-t|0;o=n>>>3;do{if(n>>>0>=256){a=de[e+(l+24)>>2]|0;o=de[e+(l+12)>>2]|0;do{if((o|0)==(h|0)){i=e+(l+20)|0;r=de[i>>2]|0;if(!r){i=e+(l+16)|0;r=de[i>>2]|0;if(!r){u=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;u=r;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();r=n+12|0;if((de[r>>2]|0)!=(h|0))Xe();i=o+8|0;if((de[i>>2]|0)==(h|0)){de[r>>2]=o;de[i>>2]=n;u=o;break}else Xe()}}while(0);if(a){r=de[e+(l+28)>>2]|0;i=908+(r<<2)|0;if((h|0)==(de[i>>2]|0)){de[i>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=a+16|0;if((de[r>>2]|0)==(h|0))de[r>>2]=u;else de[a+20>>2]=u;if(!u)break}i=de[155]|0;if(u>>>0>>0)Xe();de[u+24>>2]=a;r=de[e+(l+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{de[u+16>>2]=r;de[r+24>>2]=u;break}}while(0);r=de[e+(l+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[u+20>>2]=r;de[r+24>>2]=u;break}}}else{n=de[e+(l+8)>>2]|0;i=de[e+(l+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(h|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(h|0))a=r;else Xe()}else a=i+8|0;de[n+12>>2]=i;de[a>>2]=n}}while(0);if(f>>>0<16){de[p>>2]=c|d&1|2;t=e+(c|4)|0;de[t>>2]=de[t>>2]|1;return e|0}else{de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|3;d=e+(c|4)|0;de[d>>2]=de[d>>2]|1;qr(e+t|0,f);return e|0}return 0}function qr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0;m=e+t|0;r=de[e+4>>2]|0;do{if(!(r&1)){u=de[e>>2]|0;if(!(r&3))return;f=e+(0-u)|0;c=u+t|0;l=de[155]|0;if(f>>>0>>0)Xe();if((f|0)==(de[156]|0)){i=e+(t+4)|0;r=de[i>>2]|0;if((r&3|0)!=3){_=f;a=c;break}de[153]=c;de[i>>2]=r&-2;de[e+(4-u)>>2]=c|1;de[m>>2]=c;return}o=u>>>3;if(u>>>0<256){n=de[e+(8-u)>>2]|0;i=de[e+(12-u)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(f|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(f|0))s=r;else Xe()}else s=i+8|0;de[n+12>>2]=i;de[s>>2]=n;_=f;a=c;break}s=de[e+(24-u)>>2]|0;n=de[e+(12-u)>>2]|0;do{if((n|0)==(f|0)){n=16-u|0;i=e+(n+4)|0;r=de[i>>2]|0;if(!r){i=e+n|0;r=de[i>>2]|0;if(!r){h=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;h=r;break}}else{o=de[e+(8-u)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(f|0))Xe();i=n+8|0;if((de[i>>2]|0)==(f|0)){de[r>>2]=n;de[i>>2]=o;h=n;break}else Xe()}}while(0);if(s){r=de[e+(28-u)>>2]|0;i=908+(r<<2)|0;if((f|0)==(de[i>>2]|0)){de[i>>2]=h;if(!h){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=s+16|0;if((de[r>>2]|0)==(f|0))de[r>>2]=h;else de[s+20>>2]=h;if(!h){_=f;a=c;break}}n=de[155]|0;if(h>>>0>>0)Xe();de[h+24>>2]=s;r=16-u|0;i=de[e+r>>2]|0;do{if(i)if(i>>>0>>0)Xe();else{de[h+16>>2]=i;de[i+24>>2]=h;break}}while(0);r=de[e+(r+4)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[h+20>>2]=r;de[r+24>>2]=h;_=f;a=c;break}else{_=f;a=c}}else{_=f;a=c}}else{_=e;a=t}}while(0);l=de[155]|0;if(m>>>0>>0)Xe();r=e+(t+4)|0;i=de[r>>2]|0;if(!(i&2)){if((m|0)==(de[157]|0)){v=(de[154]|0)+a|0;de[154]=v;de[157]=_;de[_+4>>2]=v|1;if((_|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){v=(de[153]|0)+a|0;de[153]=v;de[156]=_;de[_+4>>2]=v|1;de[_+v>>2]=v;return}a=(i&-8)+a|0;o=i>>>3;do{if(i>>>0>=256){s=de[e+(t+24)>>2]|0;n=de[e+(t+12)>>2]|0;do{if((n|0)==(m|0)){i=e+(t+20)|0;r=de[i>>2]|0;if(!r){i=e+(t+16)|0;r=de[i>>2]|0;if(!r){d=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;d=r;break}}else{o=de[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(m|0))Xe();i=n+8|0;if((de[i>>2]|0)==(m|0)){de[r>>2]=n;de[i>>2]=o;d=n;break}else Xe()}}while(0);if(s){r=de[e+(t+28)>>2]|0;i=908+(r<<2)|0;if((m|0)==(de[i>>2]|0)){de[i>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=s+16|0;if((de[r>>2]|0)==(m|0))de[r>>2]=d;else de[s+20>>2]=d;if(!d)break}i=de[155]|0;if(d>>>0>>0)Xe();de[d+24>>2]=s;r=de[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{de[d+16>>2]=r;de[r+24>>2]=d;break}}while(0);r=de[e+(t+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[d+20>>2]=r;de[r+24>>2]=d;break}}}else{n=de[e+(t+8)>>2]|0;i=de[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(m|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(m|0))p=r;else Xe()}else p=i+8|0;de[n+12>>2]=i;de[p>>2]=n}}while(0);de[_+4>>2]=a|1;de[_+a>>2]=a;if((_|0)==(de[156]|0)){de[153]=a;return}}else{de[r>>2]=i&-2;de[_+4>>2]=a|1;de[_+a>>2]=a}r=a>>>3;if(a>>>0<256){i=r<<1;o=644+(i<<2)|0;n=de[151]|0;r=1<>2]|0;if(i>>>0<(de[155]|0)>>>0)Xe();else{g=r;v=i}}else{de[151]=n|r;g=644+(i+2<<2)|0;v=o}de[g>>2]=_;de[v+12>>2]=_;de[_+8>>2]=v;de[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{g=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(m|g|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;de[_+28>>2]=o;de[_+20>>2]=0;de[_+16>>2]=0;i=de[152]|0;n=1<>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}r=de[r>>2]|0;e:do{if((de[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){i=r+16+(o>>>31<<2)|0;n=de[i>>2]|0;if(!n)break;if((de[n+4>>2]&-8|0)==(a|0)){r=n;break e}else{o=o<<1;r=n}}if(i>>>0<(de[155]|0)>>>0)Xe();de[i>>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}}while(0);i=r+8|0;n=de[i>>2]|0;v=de[155]|0;if(!(n>>>0>=v>>>0&r>>>0>=v>>>0))Xe();de[n+12>>2]=_;de[i>>2]=_;de[_+8>>2]=n;de[_+12>>2]=r;de[_+24>>2]=0;return}function Gr(){}function Vr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;i=t-i-(r>>>0>e>>>0|0)>>>0;return(re=i,e-r>>>0|0)|0}function Yr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;n=i&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){pe[e>>0]=t;e=e+1|0}}while((e|0)<(n|0)){de[e>>2]=a;e=e+4|0}}while((e|0)<(i|0)){pe[e>>0]=t;e=e+1|0}return e-r|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Jr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+i+(r>>>0>>0|0)>>>0,r|0)|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if((r|0)>=4096)return Me(e|0,t|0,r|0)|0;i=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return i|0;pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){de[e>>2]=de[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return i|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function ei(e){e=e|0;var t=0;t=pe[g+(e&255)>>0]|0;if((t|0)<8)return t|0;t=pe[g+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=pe[g+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(pe[g+(e>>>24)>>0]|0)+24|0}function ti(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0;o=e&65535;n=t&65535;r=_e(n,o)|0;i=e>>>16;e=(r>>>16)+(_e(n,i)|0)|0;n=t>>>16;t=_e(n,o)|0;return(re=(e>>>16)+(_e(n,i)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function ri(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=t>>31|((t|0)<0?-1:0)<<1;l=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=i>>31|((i|0)<0?-1:0)<<1;n=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;s=Vr(u^e,l^t,u,l)|0;a=re;e=o^u;t=n^l;return Vr((si(s,a,Vr(o^r,n^i,o,n)|0,re,0)|0)^e,re^t,e,t)|0}function ii(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;n=ve;ve=ve+16|0;s=n|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;u=i>>31|((i|0)<0?-1:0)<<1;l=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;e=Vr(a^e,o^t,a,o)|0;t=re;si(e,t,Vr(u^r,l^i,u,l)|0,re,s)|0;i=Vr(de[s>>2]^a,de[s+4>>2]^o,a,o)|0;r=re;ve=n;return(re=r,i)|0}function ni(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;n=e;o=r;r=ti(n,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(i,n)|0)+e|e&0,r|0|0)|0}function oi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return si(e,t,r,i,0)|0}function ai(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;o=ve;ve=ve+16|0;n=o|0;si(e,t,r,i,n)|0;ve=o;return(re=de[n+4>>2]|0,de[n>>2]|0)|0}function si(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;h=e;l=t;u=l;a=r;f=i;s=f;if(!u){o=(n|0)!=0;if(!s){if(o){de[n>>2]=(h>>>0)%(a>>>0);de[n+4>>2]=0}f=0;n=(h>>>0)/(a>>>0)>>>0;return(re=f,n)|0}else{if(!o){f=0;n=0;return(re=f,n)|0}de[n>>2]=e|0;de[n+4>>2]=t&0;f=0;n=0;return(re=f,n)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(u|0)|0)|0;if(o>>>0<=31){c=o+1|0;s=31-o|0;t=o-31>>31;a=c;e=h>>>(c>>>0)&t|u<>>(c>>>0)&t;o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;f=0;n=0;return(re=f,n)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(u|0)|0)|0;d=64-s|0;c=32-s|0;l=c>>31;p=s-32|0;t=p>>31;a=s;e=c-1>>31&u>>>(p>>>0)|(u<>>(s>>>0))&t;t=t&u>>>(s>>>0);o=h<>>(p>>>0))&l|h<>31;break}if(n){de[n>>2]=o&h;de[n+4>>2]=0}if((a|0)==1){p=l|t&0;d=e|0|0;return(re=p,d)|0}else{d=ei(a|0)|0;p=u>>>(d>>>0)|0;d=u<<32-d|h>>>(d>>>0)|0;return(re=p,d)|0}}else{if(o){if(n){de[n>>2]=(u>>>0)%(a>>>0);de[n+4>>2]=0}p=0;d=(u>>>0)/(a>>>0)>>>0;return(re=p,d)|0}if(!h){if(n){de[n>>2]=0;de[n+4>>2]=(u>>>0)%(s>>>0)}p=0;d=(u>>>0)/(s>>>0)>>>0;return(re=p,d)|0}o=s-1|0;if(!(o&s)){if(n){de[n>>2]=e|0;de[n+4>>2]=o&u|t&0}p=0;d=u>>>((ei(s|0)|0)>>>0);return(re=p,d)|0}o=(ae(s|0)|0)-(ae(u|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=u<>>(t>>>0);t=u>>>(t>>>0);o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;p=0;d=0;return(re=p,d)|0}}while(0);if(!a){u=s;l=0;s=0}else{c=r|0|0;h=f|i&0;u=Kr(c|0,h|0,-1,-1)|0;r=re;l=s;s=0;do{i=l;l=o>>>31|l<<1;o=s|o<<1;i=e<<1|i>>>31|0;f=e>>>31|t<<1|0;Vr(u,r,i,f)|0;d=re;p=d>>31|((d|0)<0?-1:0)<<1;s=p&1;e=Vr(i,f,p&c,(((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1)&h)|0;t=re;a=a-1|0}while((a|0)!=0);u=l;l=0}a=0;if(n){de[n>>2]=e;de[n+4>>2]=t}p=(o|0)>>>31|(u|a)<<1|(a<<1|o>>>31)&0|l;d=(o<<1|0>>>31)&-2|s;return(re=p,d)|0}function li(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return Pi[e&7](t|0,r|0,i|0)|0}function ui(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;Ei[e&3](t|0,r|0,i|0,n|0,o|0)}function hi(e,t){e=e|0;t=t|0;Ci[e&7](t|0)}function ci(e,t){e=e|0;t=t|0;return Ai[e&1](t|0)|0}function fi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;Ii[e&0](t|0,r|0,i|0)}function pi(e){e=e|0;Oi[e&3]()}function di(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;Mi[e&3](t|0,r|0,i|0,n|0,o|0,a|0)}function mi(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;return Di[e&1](t|0,r|0,i|0,n|0,o|0)|0}function gi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;Ri[e&3](t|0,r|0,i|0,n|0)}function vi(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function _i(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(1)}function yi(e){e=e|0;se(2)}function bi(e){e=e|0;se(3);return 0}function xi(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function wi(){se(5)}function Ti(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;se(6)}function ki(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(7);return 0}function Si(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;se(8)}var Pi=[vi,Yt,Fr,Ar,Cr,Ir,vi,vi];var Ei=[_i,tr,er,_i];var Ci=[yi,Ht,Gt,Wt,qt,Vt,lr,zr];var Ai=[bi,Er];var Ii=[xi];var Oi=[wi,ar,sr,wi];var Mi=[Ti,ir,rr,Ti];var Di=[ki,lt];var Ri=[Si,Jt,Kt,Si];return{___cxa_can_catch:nr,_crn_get_levels:Tt,_crn_get_uncompressed_size:St,_crn_decompress:Pt,_i64Add:Kr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Vr,_memset:Yr,_malloc:Br,_free:Ur,_memcpy:Qr,_bitshift64Lshr:Zr,_fflush:gr,_bitshift64Shl:Jr,_crn_get_height:wt,___errno_location:hr,_crn_get_dxt_format:kt,runPostSets:Gr,_emscripten_replace_memory:Ye,stackAlloc:Ze,stackSave:Je,stackRestore:Ke,establishStackSpace:Qe,setThrew:$e,setTempRet0:rt,getTempRet0:it,dynCall_iiii:li,dynCall_viiiii:ui,dynCall_vi:hi,dynCall_ii:ci,dynCall_viii:fi,dynCall_v:pi,dynCall_viiiiii:di,dynCall_iiiiii:mi,dynCall_viiii:gi}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>8&255,e>>16&255,e>>24&255)}!function(s){s.loadFromArrayBuffer=function(e,t,r){return new i(t).loadFromArrayBuffer(e,r)};var i=function(l){function e(e,t,r,i,n,o,a){var s=l.call(this)||this;return s.complete=!1,s.isCompressedImage=!0,s.preserveSource=!0,s.onload=null,s.baseTexture=null,s.init(e,t,r,i,n,o,a),s}return __extends(e,l),e.prototype.init=function(e,t,r,i,n,o,a){void 0===i&&(i=-1),void 0===n&&(n=-1),this.src=e,this.resize(i,n),this._width=i,this._height=n,this.data=t,this.type=r,this.levels=o,this.internalFormat=a;var s=this.complete;return this.complete=!!t,!s&&this.complete&&this.onload&&this.onload({target:this}),this.update(),this},e.prototype.dispose=function(){this.data=null},e.prototype.bind=function(e){void 0!==e.alphaMode?e.alphaMode=PIXI.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA:e.premultiplyAlpha=!1,l.prototype.bind.call(this,e)},e.prototype.upload=function(e,t,r){var i=e.state.gl;if(r.compressed=!1,e.texture.initCompressed(),null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var n=this.levels,o=this.width,a=this.height,s=0,l=0;l>=1)<1&&(o=1),(a>>=1)<1&&(a=1),s+=u}return this._internalLoader.free(),this.preserveSource||(this.data=null),!0},e.prototype.style=function(e,t,r){var i=e.state.gl,n=this.levels;return t.scaleMode===PIXI.SCALE_MODES.LINEAR?1>2)*(t+3>>2)*8;case 33778:case 33779:case 35987:case 34798:return(e+3>>2)*(t+3>>2)*16;default:return 0}},h.type="DDS",h}(e.AbstractInternalLoader);e.DDSLoader=l}(pixi_compressed_textures||(pixi_compressed_textures={})),function(e){var t,c=((t={})[0]=35841,t[1]=35843,t[2]=35840,t[3]=35842,t[6]=36196,t[7]=33776,t[9]=33778,t[5]=33779,t),r=function(t){function h(e){return t.call(this,e)||this}return __extends(h,t),h.prototype.load=function(e){if(!h.test(e))throw"Invalid magic number in PVR header";var t=new Int32Array(e,0,13),r=t[2],i=c[r]||-1,n=t[7],o=t[6],a=t[11],s=t[12]+52,l=new Uint8Array(e,s),u=this._image;return this._format=i,u.init(u.src,l,"PVR",n,o,a,i),u},h.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},h.prototype.levelBufferSize=function(e,t,r){switch(void 0===r&&(r=0),this._format){case 33776:case 36196:return(e+3>>2)*(t+3>>2)*8;case 33778:case 33779:return(e+3>>2)*(t+3>>2)*16;case 35840:case 35842:return Math.floor((Math.max(e,8)*Math.max(t,8)*4+7)/8);case 35841:case 35843:return Math.floor((Math.max(e,16)*Math.max(t,8)*2+7)/8);default:return 0}},h.type="PVR",h}(e.AbstractInternalLoader);e.PVRTCLoader=r}(pixi_compressed_textures||(pixi_compressed_textures={})),function(l){var e,t,r=0,i=2,n=3,o=8,a=9,s=10,u=11,c=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),h=((t={})[u]=-1,t[r]=36196,t[i]=33776,t[n]=33779,t[o]=35840,t[a]=35842,t[s]=37808,t),f=Object.keys(h).reduce(function(e,t){return e[h[+t]]=+t,e},{}),p=function(r){function h(e){var t=r.call(this,e)||this;return t.type="BASIS",t._file=void 0,t}return __extends(h,r),h.test=function(e){var t=1262195===new Uint32Array(e,0,1)[0]&&!!h.BASIS_BINDING,r=h.RGB_FORMAT&&h.RGBA_FORMAT;return!t&&r&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),r&&t},h.bindTranscoder=function(e,i){if(!e||!i)throw"Invalid state! undef fileCtr or ext invalid!";var t=Object.keys(i).reduce(function(e,t){var r=i[t];return r?Object.assign(e,r.__proto__):e},{}),r=void 0,n=void 0;for(var o in t){var a=t[o];if(void 0!==f[a]){var s=f[a];c[s]?n={native:a,name:o,basis:s}:r={native:a,name:o,basis:s}}}h.RGB_FORMAT=r||n,h.RGBA_FORMAT=n||r,h.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+h.RGB_FORMAT.name+"\nRGBA:"+h.RGBA_FORMAT.name),l.RegisterCompressedLoader(h),l.RegisterCompressedExtensions("basis")},h.prototype.load=function(e){if(!h.test(e))throw"BASIS Transcoder not binded or transcoding not supported =(!";return this._loadAsync(e),this._image},h.prototype._loadAsync=function(e){var t=performance.now(),r=new h.BASIS_BINDING(new Uint8Array(e)),i=r.getImageWidth(0,0),n=r.getImageHeight(0,0),o=r.getHasAlpha(),a=this._image;if(!r.startTranscoding())throw"Transcoding error!";var s=o?h.RGBA_FORMAT:h.RGB_FORMAT;console.log("Grats! BASIS will be transcoded to:",s);var l=new Uint8Array(r.getImageTranscodedSizeInBytes(0,0,s.basis));if(!r.transcodeImage(l,0,0,s.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=s.native,this._file=r;var u=s.name.replace("COMPRESSED_","");return Promise.resolve(a.init(a.src,l,"BASIS|"+u,i,n,1,s.native))},h.prototype.levelBufferSize=function(e,t,r){return this._file?this._file.getImageTranscodedSizeInBytes(0,r,f[this._format]):void 0},h.BASIS_BINDING=void 0,h}(l.AbstractInternalLoader);l.BASISLoader=p}(pixi_compressed_textures||(pixi_compressed_textures={})),function(i){var p=window.CRN_Module;var d=[33776,33778,33779],e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.load=function(e){var t=e.byteLength,r=new Uint8Array(e),i=p._malloc(t);!function(e,t,r,i){for(var n=r/4,o=i%4,a=new Uint32Array(e.buffer,0,(i-o)/4),s=new Uint32Array(t.buffer),l=0;li.count)){var e=new a;return i.workers.push(e),e.init(t,r).then(function(){r=e.binary,o()})}};return o().then(function(){return i})},e.prototype.transcode=function(t,r){if(!this.workers||!this.workers.length)throw"[TranscoderWorkerPool] Pool empty, populate before!";var n=this.workers,o=void 0,a=0,s=function(e){for(var t=0,r=n;t 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,i)},e}(n.Filter),d=function(i){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),i.call(this,"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}",r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}"),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new f.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}i&&(e.__proto__=i);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n,o=this.pixelSize.x/t._frame.width,a=this.pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)n=this._kernels[0]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,e.applyFilter(this,t,r,i);else{for(var s,l=e.getFilterTexture(),u=t,h=l,c=this._quality-1,f=0;f threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(n.Filter),i=function(a){function e(e){a.call(this,c,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:p.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._extractFilter=new m(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,i,n){var o=e.getFilterTexture();this._extractFilter.apply(e,t,o,!0,n);var a=e.getFilterTexture();this._blurFilter.apply(e,o,a,!0,n),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,i),e.returnFilterTexture(a),e.returnFilterTexture(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),o=function(t){function e(e){void 0===e&&(e=8),t.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(n.Filter),a=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/f.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*f.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return l.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){l.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return l.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){l.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(n.Filter),g=function(a){function e(e,t,r,i){var n,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=p.settings.RESOLUTION),void 0===i&&(i=5),a.call(this),"number"==typeof e?o=n=e:e instanceof f.Point?(n=e.x,o=e.y):Array.isArray(e)&&(n=e[0],o=e[1]),this.blurXFilter=new h.BlurFilterPass(!0,n,t,r,i),this.blurYFilter=new h.BlurFilterPass(!1,o,t,r,i),this.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,this.defaultFilter=new u.AlphaFilter}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,i),this.blurYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(n.Filter),v=function(i){function e(e,t,r){i.call(this,"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}","uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}i&&(e.__proto__=i);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(n.Filter),_=function(i){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}"),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}i&&(e.__proto__=i);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,i)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof n.Texture||(e=n.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),i.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(n.Filter),y=function(i){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n"),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(l.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=l.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(l.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=l.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(n.Filter),b=function(i){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),i.call(this,"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}","precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"),this.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(n.Filter),x=function(e){function t(){e.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(n.Filter),w=function(t){function e(e){t.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(n.Filter),T=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n"),this.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),k=function(c){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:p.settings.RESOLUTION},e),c.call(this);var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._tintFilter=new c("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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new f.Point,this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o;var a=e.shadowOnly,s=e.rotation,l=e.distance,u=e.alpha,h=e.color;this.shadowOnly=a,this.rotation=s,this.distance=l,this.alpha=u,this.color=h,this._updatePadding()}c&&(e.__proto__=c);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(c&&c.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=e.getFilterTexture();this._tintFilter.apply(e,t,n,!0),this._blurFilter.apply(e,n,r,i),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnFilterTexture(n)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateShift()},t.rotation.get=function(){return this.angle/f.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*f.DEG_TO_RAD,this._updateShift()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return l.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){l.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),S=function(t){function e(e){void 0===e&&(e=5),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n"),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(n.Filter),P=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n"),this.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=n.Texture.from(this._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=t.filterFrame.width,o=t.filterFrame.height;this.uniforms.dimensions[0]=n,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/n,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,i)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,i=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var n=this._slices,o=1,a=0;a>0,i=e[t];e[t]=e[r],e[r]=i}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),n+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")";t[3*i]=-1;for(var n=0;n 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,i)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(n.Filter),M=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var i=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),n=(2*Math.PI/i).toFixed(7);o.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,n)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,i){this.uniforms.thickness[0]=this.thickness/t._frame.width,this.uniforms.thickness[1]=this.thickness/t._frame.height,e.applyFilter(this,t,r,i)},e.color.get=function(){return l.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){l.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(n.Filter);M.MIN_SAMPLES=1,M.MAX_SAMPLES=100;var D=function(t){function e(e){void 0===e&&(e=10),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(n.Filter),R=function(n){function e(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n"),this._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=i}n&&(e.__proto__=n);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,i)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),z=function(t){function e(e){t.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n"),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(n.Filter),F=function(i){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),i.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=e,this.green=t,this.blue=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(n.Filter),L=function(i){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n"),this.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}i&&(e.__proto__=i);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),j=function(i){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}i&&(e.__proto__=i);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(l.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=l.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(n.Filter),N=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new f.Point(0,window.innerHeight/2),this.uniforms.end=i||new f.Point(600,window.innerHeight/2),this.uniforms.delta=new f.Point(30,30),this.uniforms.texSize=new f.Point(window.innerWidth,window.innerHeight),this.updateDelta()}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(n.Filter),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(N),U=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(N),X=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this),this.tiltShiftXFilter=new B(e,t,r,i),this.tiltShiftYFilter=new U(e,t,r,i)}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture();this.tiltShiftXFilter.apply(e,t,i),this.tiltShiftYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(n.Filter),H=function(i){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),i.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),this.radius=e,this.angle=t,this.padding=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),W=function(n){function e(e,t,r,i){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=i}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=i,e.AsciiFilter=o,e.BevelFilter=a,e.BloomFilter=g,e.BulgePinchFilter=v,e.CRTFilter=w,e.ColorMapFilter=_,e.ColorReplaceFilter=y,e.ConvolutionFilter=b,e.CrossHatchFilter=x,e.DotFilter=T,e.DropShadowFilter=k,e.EmbossFilter=S,e.GlitchFilter=P,e.GlowFilter=E,e.GodrayFilter=C,e.KawaseBlurFilter=d,e.MotionBlurFilter=A,e.MultiColorReplaceFilter=I,e.OldFilmFilter=O,e.OutlineFilter=M,e.PixelateFilter=D,e.RGBSplitFilter=F,e.RadialBlurFilter=R,e.ReflectionFilter=z,e.ShockwaveFilter=L,e.SimpleLightmapFilter=j,e.TiltShiftAxisFilter=N,e.TiltShiftFilter=X,e.TiltShiftXFilter=B,e.TiltShiftYFilter=U,e.TwistFilter=H,e.ZoomBlurFilter=W,e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),pixi_projection,pixi_projection;Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},function(p,v){"use strict";var t,f,d=function(){function f(e,t,r){this.value=e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:p.ParticleUtils.generateEase(r):null}return f.createList=function(e){if("list"in e){var t=e.list,r=void 0,i=void 0,n=t[0],o=n.value,a=n.time;if(i=r=new f("string"==typeof o?p.ParticleUtils.hexToRGB(o):o,a,e.ease),2a.time;)n=a,a=e[++o];l=(l-n.time)/(a.time-n.time);var u=f.hexToRGB(n.value),h=f.hexToRGB(a.value),c={r:(h.r-u.r)*l+u.r,g:(h.g-u.g)*l+u.g,b:(h.b-u.b)*l+u.b};i.next=new d(c,s/t),i=i.next}return r};var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?a:r:e.isStepped?this.interpolate=this.isColor?c:u:this.interpolate=this.isColor?l:s,this.ease=this.current.ease},e}();function r(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function a(e){this.ease&&(e=this.ease(e));var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function s(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function l(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function u(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function c(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return p.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}var m,g=function(r){function i(e){var t=r.call(this)||this;return t.emitter=e,t.anchor.x=t.anchor.y=.5,t.velocity=new v.Point,t.rotationSpeed=0,t.rotationAcceleration=0,t.maxLife=0,t.age=0,t.ease=null,t.extraData=null,t.alphaList=new o,t.speedList=new o,t.speedMultiplier=1,t.acceleration=new v.Point,t.maxSpeed=NaN,t.scaleList=new o,t.scaleMultiplier=1,t.colorList=new o(!0),t._doAlpha=!1,t._doScale=!1,t._doSpeed=!1,t._doAcceleration=!1,t._doColor=!1,t._doNormalMovement=!1,t._oneOverLife=0,t.next=null,t.prev=null,t.init=t.init,t.Particle_init=i.prototype.init,t.update=t.update,t.Particle_update=i.prototype.update,t.Sprite_destroy=r.prototype.destroy,t.Particle_destroy=i.prototype.destroy,t.applyArt=t.applyArt,t.kill=t.kill,t}return n(i,r),i.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,p.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=p.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=p.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=p.ParticleUtils.DEG_TO_RADS,this.alpha=this.alphaList.current.value,this.scale.x=this.scale.y=this.scaleList.current.value,this._doAlpha=!!this.alphaList.current.next,this._doSpeed=!!this.speedList.current.next,this._doScale=!!this.scaleList.current.next,this._doColor=!!this.colorList.current.next,this._doAcceleration=0!==this.acceleration.x||0!==this.acceleration.y,this._doNormalMovement=this._doSpeed||0!==this.speedList.current.value||this._doAcceleration,this._oneOverLife=1/this.maxLife;var e=this.colorList.current.value;this.tint=p.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},i.prototype.applyArt=function(e){this.texture=e||v.Texture.EMPTY},i.prototype.update=function(e){if(this.age+=e,this.age>=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(this.ease&&(t=4==this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){var i=void 0,n=void 0;if(this._doSpeed){var o=this.speedList.interpolate(t)*this.speedMultiplier;p.ParticleUtils.normalize(this.velocity),p.ParticleUtils.scaleBy(this.velocity,o),i=this.velocity.x*e,n=this.velocity.y*e}else if(this._doAcceleration){var a=this.velocity.x,s=this.velocity.y;if(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed){var l=p.ParticleUtils.length(this.velocity);l>this.maxSpeed&&p.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/l)}i=(a+this.velocity.x)/2*e,n=(s+this.velocity.y)/2*e}else i=this.velocity.x*e,n=this.velocity.y*e;this.position.x+=i,this.position.y+=n}if(this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration){var u=this.rotationSpeed+this.rotationAcceleration*e;this.rotation+=(this.rotationSpeed+u)/2*e,this.rotationSpeed=u}else 0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x));return t},i.prototype.kill=function(){this.emitter.recycle(this)},i.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},i.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(p.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles)this._spawnTimer+=this._frequency;else{var l=void 0;if(l=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var p=void 0;if(this._poolFirst?(p=this._poolFirst,this._poolFirst=this._poolFirst.next,p.next=null):p=new this.particleConstructor(this),1=this.particleImages.length)&&(this._currentImageIndex=0)):p.applyArt(this.particleImages[Math.floor(Math.random()*this.particleImages.length)]):p.applyArt(this.particleImages[0]),p.alphaList.reset(this.startAlpha),1!=this.minimumSpeedMultiplier&&(p.speedMultiplier=Math.random()*(1-this.minimumSpeedMultiplier)+this.minimumSpeedMultiplier),p.speedList.reset(this.startSpeed),p.acceleration.x=this.acceleration.x,p.acceleration.y=this.acceleration.y,p.maxSpeed=this.maxSpeed,1!=this.minimumScaleMultiplier&&(p.scaleMultiplier=Math.random()*(1-this.minimumScaleMultiplier)+this.minimumScaleMultiplier),p.scaleList.reset(this.startScale),p.colorList.reset(this.startColor),this.minRotationSpeed==this.maxRotationSpeed?p.rotationSpeed=this.minRotationSpeed:p.rotationSpeed=Math.random()*(this.maxRotationSpeed-this.minRotationSpeed)+this.minRotationSpeed,p.rotationAcceleration=this.rotationAcceleration,p.noRotation=this.noRotation,p.maxLife=l,p.blendMode=this.particleBlendMode,p.ease=this.customEase,p.extraData=this.extraData,this.applyAdditionalProperties(p),this._spawnFunc(p,u,h,t),p.init(),p.update(-this._spawnTimer),p.parent){var d=this._parent.children;if(d[0]==p)d.shift();else if(d[d.length-1]==p)d.pop();else{var m=d.indexOf(p);d.splice(m,1)}this.addAtBack?d.unshift(p):d.push(p)}else this.addAtBack?this._parent.addChildAt(p,0):this._parent.addChild(p);this._activeParticlesLast?((this._activeParticlesLast.next=p).prev=this._activeParticlesLast,this._activeParticlesLast=p):this._activeParticlesLast=this._activeParticlesFirst=p,++this.particleCount}}this._spawnTimer+=this._frequency}}if(this._posChanged&&(this._prevEmitterPos.x=a,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){var g=this._completeCallback;this._completeCallback=null,g()}this._destroyWhenComplete&&this.destroy()}}},e.prototype.applyAdditionalProperties=function(e){},e.prototype._spawnPoint=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,e.position.x=t,e.position.y=r},e.prototype._spawnRect=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,b.x=Math.random()*this.spawnRect.width+this.spawnRect.x,b.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnCircle=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,b.x=Math.random()*this.spawnCircle.radius,b.y=0,p.ParticleUtils.rotatePoint(360*Math.random(),b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnRing=function(e,t,r){var i=this.spawnCircle;this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,i.minRadius!==i.radius?b.x=Math.random()*(i.radius-i.minRadius)+i.minRadius:b.x=i.radius,b.y=0;var n=360*Math.random();e.rotation+=n,p.ParticleUtils.rotatePoint(n,b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnPolygonalChain=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,this.spawnPolygonalChain.getRandomPoint(b),0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnBurst=function(e,t,r,i){0===this.particleSpacing?e.rotation=360*Math.random():e.rotation=this.angleStart+this.particleSpacing*i+this.rotation,e.position.x=t,e.position.y=r},e.prototype.cleanup=function(){var e,t;for(e=this._activeParticlesFirst;e;e=t)t=e.next,this.recycle(e),e.parent&&e.parent.removeChild(e);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},e.prototype.destroy=function(){var e;this.autoUpdate=!1,this.cleanup();for(var t=this._poolFirst;t;t=e)e=t.next,t.destroy();this._poolFirst=this._parent=this.particleImages=this.spawnPos=this.ownerPos=this.startColor=this.startScale=this.startAlpha=this.startSpeed=this.customEase=this._completeCallback=null},e}(),w=new v.Point,T=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],k=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(T).join("|"),"g"),S=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new v.Point,t.movement=0,t}return n(e,r),e.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,w.x=this.movement,w.y=this.path(this.movement),p.ParticleUtils.rotatePoint(this.initialRotation,w),this.position.x=this.initialPosition.x+w.x,this.position.y=this.initialPosition.y+w.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return g.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(k),r=t.length-1;0<=r;--r)0<=T.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){p.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else p.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(g),P=function(r){function e(e){var t=r.call(this,e)||this;return t.textures=null,t.duration=0,t.framerate=0,t.elapsed=0,t.loop=!1,t}return n(e,r),e.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},e.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t){this.elapsed+=e,this.elapsed>this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||v.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,i,n,o,a=[],s=0;st[s]&&(i=t[s]),ot[s+1]&&(n=t[s+1]),af[u]){l=c[s];c[s]=c[u],c[u]=l;var h=f[s];f[s]=f[u],f[u]=h}if(t[0]=c[0].x,t[1]=c[0].y,t[2]=c[1].x,t[3]=c[1].y,t[4]=c[2].x,t[5]=c[2].y,t[6]=c[3].x,t[7]=c[3].y,(c[3].x-c[2].x)*(c[1].y-c[2].y)-(c[1].x-c[2].x)*(c[3].y-c[2].y)<0)return t[4]=c[3].x,void(t[5]=c[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var k=new PIXI.Matrix,n=new PIXI.Rectangle,S=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.distortion,i=e.x*e.y;return t.x=e.x+r.x*i,t.y=e.y+r.y*i,t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,i=e.y,n=this.distortion.x,o=this.distortion.y;if(0==n)t.x=r,t.y=i/(1+o*r);else if(0==o)t.y=i,t.x=r/(1+n*i);else{var a=.5*(i*n-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * vSamplerSize;\n \n// if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n// pixels.y < vFrame.y || pixels.y > vFrame.w) {\n// discard;\n// }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n//gl_FragColor = color * rColor;\n}",geometryClass:s,vertexSize:16},e),i=t.vertex,n=t.fragment,o=t.vertexSize,a=t.geometryClass;return function(r){function e(e){var t=r.call(this,e)||this;return t.defUniforms={translationMatrix:new PIXI.Matrix,distortion:new Float32Array([0,0])},t.size=1e3,t.forceMaxTextures=1,t.shaderGenerator=new PIXI.BatchShaderGenerator(i,n),t.geometryClass=a,t.vertexSize=o,t}return __extends(e,r),e.prototype.getUniforms=function(e){var t=e.proj;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.packInterleavedGeometry=function(e,t,r,i,n){for(var o=t.uint32View,a=t.float32View,s=i/this.vertexSize,l=e.indices,u=e.vertexData,h=e._texture._frame,c=e.aTrans,f=e._texture.baseTexture,p=f._batchLocation,d=f.realWidth,m=f.realHeight,g=f.resolution,v=Math.min(e.worldAlpha,1),_=v<1&&e._texture.baseTexture.alphaMode?b(e._tintRGB,v):e._tintRGB+(255*v<<24),y=0;y=o.TRANSFORM_STEP.PROJ?(i||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(e,r):this.proj.world.applyInverse(e,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copyFrom(e),n===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var l,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=l=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT",t[t.AXIS_XR=5]="AXIS_XR";var i=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,i,n,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=i,a[5]=0,a[6]=n,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,i=this.mat3;return e?(r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7]):(r[0]=i[0],r[1]=i[3],r[2]=i[6],r[3]=i[1],r[4]=i[4],r[5]=i[7],r[6]=i[2],r[7]=i[5]),r[8]=i[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,i=e.x,n=e.y,o=1/(r[2]*i+r[5]*n+r[8]);return t.x=o*(r[0]*i+r[3]*n+r[6]),t.y=o*(r[1]*i+r[4]*n+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,i){var n=this.mat3;n[0]=e*n[0]+r*n[2],n[1]=t*n[1]+i*n[2],n[3]=e*n[3]+r*n[5],n[4]=t*n[4]+i*n[5],n[6]=e*n[6]+r*n[8],n[7]=t*n[7]+i*n[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,i=e.x,n=e.y,o=r[0],a=r[3],s=r[6],l=r[1],u=r[4],h=r[7],c=r[2],f=r[5],p=r[8],d=(p*u-h*f)*i+(-p*a+s*f)*n+(h*a-s*u),m=(-p*l+h*c)*i+(p*o-s*c)*n+(-h*o+s*l),g=(f*l-u*c)*i+(-f*o+a*c)*n+(u*o-a*l);return t.x=d/g,t.y=m/g,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=u*o-a*l,c=-u*n+a*s,f=l*n-o*s,p=t*h+r*c+i*f;return p&&(p=1/p,e[0]=h*p,e[1]=(-u*r+i*l)*p,e[2]=(a*r-i*o)*p,e[3]=c*p,e[4]=(u*t-i*s)*p,e[5]=(-a*t+i*n)*p,e[6]=f*p,e[7]=(-l*t+r*s)*p,e[8]=(o*t-r*n)*p),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo2dOr3d=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copyTo=function(e,t,r){var i=this.mat3,n=1/i[8],o=i[6]*n,a=i[7]*n;if(e.a=(i[0]-i[2]*o)*n,e.b=(i[1]-i[2]*a)*n,e.c=(i[3]-i[5]*o)*n,e.d=(i[4]-i[5]*a)*n,e.tx=o,e.ty=a,2<=t){var s=e.a*e.d-e.b*e.c;r||(s=Math.abs(s)),t===l.POINT?(s=0>0,0!==f._cycle&&f._cycle===f._totalTime/a&&m<=e&&f._cycle--,f._time=f._totalTime-f._cycle*a,f._yoyo&&0!=(1&f._cycle)&&(f._time=v-f._time,(c=f._yoyoEase||f.vars.yoyoEase)&&(f._yoyoEase||(!0!==c||f._initted?f._yoyoEase=c=!0===c?f._ease:c instanceof Ease?c:Ease.map[c]:(c=f.vars.ease,f._yoyoEase=c=c?c instanceof Ease?c:"function"==typeof c?new Ease(c,f.vars.easeParams):Ease.map[c]||y.defaultEase:y.defaultEase)),f.ratio=c?1-c.getRatio((v-f._time)/v):0)),f._time>v?f._time=v:f._time<0&&(f._time=0)),f._easeType&&!c?(s=f._time/v,(1===(l=f._easeType)||3===l&&.5<=s)&&(s=1-s),3===l&&(s*=2),1===(u=f._easePower)?s*=s:2===u?s*=s*s:3===u?s*=s*s*s:4===u&&(s*=s*s*s*s),f.ratio=1===l?1-s:2===l?s:f._time/v<.5?s/2:1-s/2):c||(f.ratio=f._ease.getRatio(f._time/v))),d!==f._time||r||g!==f._cycle){if(!f._initted){if(f._init(),!f._initted||f._gc)return;if(!r&&f._firstPT&&(!1!==f.vars.lazy&&f._duration||f.vars.lazy&&!f._duration))return f._time=d,f._totalTime=m,f._rawPrevTime=_,f._cycle=g,x.lazyTweens.push(f),void(f._lazy=[e,t]);!f._time||i||c?i&&this._ease._calcEnd&&!c&&(f.ratio=f._ease.getRatio(0===f._time?0:1)):f.ratio=f._ease.getRatio(f._time/v)}for(!1!==f._lazy&&(f._lazy=!1),f._active||!f._paused&&f._time!==d&&0<=e&&(f._active=!0),0===m&&(2===f._initted&&0e._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}c._onUpdate&&(t||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].time>0||6)-1,c=[],f=[];for(r in e)d(e[r],a,t);for(n=a.length,i=0;i>0]=f,s[o]=u,l=0,f=[]);return{length:u,lengths:s,segments:c}}(this._beziers,this._timeRes);this._length=f.length,this._lengths=f.lengths,this._segments=f.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(c=this._autoRotate)for(this._initialRotations=[],c[0]instanceof Array||(this._autoRotate=c=[c]),o=c.length;-1<--o;){for(a=0;a<3;a++)i=c[o][a],this._func[i]="function"==typeof e[i]&&e[i.indexOf("set")||"function"!=typeof e["get"+i.substr(3)]?i:"get"+i.substr(3)];i=c[o][2],this._initialRotations[o]=(this._func[i]?this._func[i].call(this._target):this._target[i])||0,this._overwriteProps.push(i)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,i,n,o,a,s,l,u,h,c,f=this._segCount,p=this._func,d=this._target,m=e!==this._startRatio;if(this._timeRes){if(u=this._lengths,h=this._curSeg,c=e*this._length,i=this._li,c>this._l2&&i=c;);0===i&&cthis._s2&&i=c;);0===i&&c>0)*(1/f))*f;for(r=1-a,i=this._props.length;-1<--i;)n=this._props[i],s=(a*a*(o=this._beziers[n][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s;if(this._autoRotate){var g,v,_,y,b,x,w,T=this._autoRotate;for(i=T.length;-1<--i;)n=T[i][2],x=T[i][3]||0,w=!0===T[i][4]?1:k,o=this._beziers[T[i][0]],g=this._beziers[T[i][1]],o&&g&&(o=o[t],g=g[t],v=o.a+(o.b-o.a)*a,v+=((y=o.b+(o.c-o.b)*a)-v)*a,y+=(o.c+(o.d-o.c)*a-y)*a,_=g.a+(g.b-g.a)*a,_+=((b=g.b+(g.c-g.b)*a)-_)*a,b+=(g.c+(g.d-g.c)*a-b)*a,s=m?Math.atan2(b-_,y-v)*w+x:this._initialRotations[i],this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s)}}}),e=g.prototype,g.bezierThrough=p,g.cubicToQuadratic=S,g._autoCSS=!0,g.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},g._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,p=t._parseToProxy,d=t._setPluginRatio,m=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,i,n,o){t instanceof Array&&(t={values:t}),o=new g;var a,s,l,u=t.values,h=u.length-1,c=[],f={};if(h<0)return n;for(a=0;a<=h;a++)l=p(e,u[a],i,n,o,h!==a),c[a]=l.end;for(s in t)f[s]=t[s];return f.values=c,(n=new m(e,"bezier",0,0,l.pt,2)).data=l,n.plugin=o,n.setRatio=d,0===f.autoRotate&&(f.autoRotate=!0),!f.autoRotate||f.autoRotate instanceof Array||(a=!0===f.autoRotate?0:Number(f.autoRotate),f.autoRotate=null!=l.end.left?[["left","top","rotation",a,!1]]:null!=l.end.x&&[["x","y","rotation",a,!1]]),f.autoRotate&&(i._transform||i._enableTransforms(!1),l.autoRotate=i._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,i._overwriteProps.push("rotation")),o._onInitTween(l.proxy,f,i._tween),n}})}},e._mod=function(e){for(var t,r=this._overwriteProps,i=r.length;-1<--i;)(t=e[r[i]])&&"function"==typeof t&&(this._mod[r[i]]=t)},e._kill=function(e){var t,r,i=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=i.length;-1<--r;)i[r]===t&&i.splice(r,1);if(i=this._autoRotate)for(r=i.length;-1<--r;)e[i[r][2]]&&i.splice(r,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,B){var d,k,S,m,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},u=_gsScope._gsDefine.globals,g={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.3",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var E,v,_,L,y,P,C,A,t,r,I=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,n=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi,h=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,M=/(?:\d|\-|\+|=|#|\.)*/g,D=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,l=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,c=function(e,t){return t.toUpperCase()},p=/(?:Left|Right|Width)/i,f=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,R=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,z=/,(?=[^\)]*(?:\(|$))/gi,F=/[\s,\(]/i,j=Math.PI/180,X=180/Math.PI,N={},i={style:{}},H=_gsScope.document||{createElement:function(){return i}},W=function(e,t){var r=H.createElementNS?H.createElementNS(t||"http://www.w3.org/1999/xhtml",e):H.createElement(e);return r.style?r:H.createElement(e)},q=W("div"),G=W("img"),V=U._internals={_specialProps:g},Y=(_gsScope.navigator||{}).userAgent||"",Z=(t=Y.indexOf("Android"),r=W("a"),_=-1!==Y.indexOf("Safari")&&-1===Y.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),me[e])r=me[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(i=e.charAt(1))+i+(n=e.charAt(2))+n+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=f=e.match(I),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,i=2*(l=Number(r[2])/100)-(n=l<=.5?l*(s+1):l+s-l*s),3i--)for(;++ii--)for(;++i>0];return i.parse(e,a,n,o)}},we=(V._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,i,n,o,a=this.data,s=a.proxy,l=a.firstMPT;l;)t=s[l.v],l.r?t=l.r(t):t<1e-6&&-1e-6s.length?l.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:l)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:l=o,o=u}this._firstPT=s}return!0},e.parse=function(e,t,r,i){var n,o,a,s,l,u,h,c,f,p,d=e.style;for(n in t){if(u=t[n],o=g[n],"function"!=typeof u||o&&o.allowFunc||(u=u(A,C)),o)r=o.parse(e,u,n,this,r,i,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",re(e).getPropertyValue(n)+"",u+"",n,!1,n);continue}l=ie(e,n,S)+"",f="string"==typeof u,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||f&&w.test(u)?(f||(u=(3<(u=ve(u)).length?"rgba(":"rgb(")+u.join(",")+")"),r=Se(d,n,l,u,!0,"transparent",r,0,i)):f&&F.test(u)?r=Se(d,n,l,u,!0,null,r,0,i):(h=(a=parseFloat(l))||0===a?l.substr((a+"").length):"",""!==l&&"auto"!==l||(h="width"===n||"height"===n?(a=he(e,n,S),"px"):"left"===n||"top"===n?(a=oe(e,n,S),"px"):(a="opacity"!==n?0:1,"")),""===(c=(p=f&&"="===u.charAt(1))?(s=parseInt(u.charAt(0)+"1",10),u=u.substr(2),s*=parseFloat(u),u.replace(M,"")):(s=parseFloat(u),f?u.replace(M,""):""))&&(c=n in k?k[n]:h),u=s||0===s?(p?s+a:s)+c:t[n],h!==c&&(""===c&&"lineHeight"!==n||(s||0===s)&&a&&(a=ne(e,n,a,h),"%"===c?(a/=ne(e,n,100,"%")/100,!0!==t.strictUnits&&(l=a+"%")):"em"===c||"rem"===c||"vw"===c||"vh"===c?a/=ne(e,n,1,c):"px"!==c&&(s=ne(e,n,s,c),c="px"),p&&(s||0===s)&&(u=s+a+c))),p&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==d[n]&&(u||u+""!="NaN"&&null!=u)?(r=new Te(d,n,s||a||0,0,r,-1,n,!1,0,l,u)).xs0="none"!==u||"display"!==n&&-1===n.indexOf("Style")?u:l:K("invalid "+n+" tween value: "+t[n]):(r=new Te(d,n,a,s-a,r,0,n,!1!==E&&("px"===c||"zIndex"===n),0,l,u)).xs0=c)}i&&r&&!r.plugin&&(r.plugin=i)}return r},e.setRatio=function(e){var t,r,i,n=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;n;){if(t=n.c*e+n.s,n.r?t=n.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},d.ease=new d(.7,.7),m.config=d.config=function(e,t,r){return new d(e,t,r)},(m=(r=l("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new g).constructor=r,m.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},m.config=r.config=function(e,t){return new r(e,t)},(m=(i=l("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new g).constructor=i,m.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},m.config=i.config=function(e,t,r){return new i(e,t,r)},(m=(t=l("easing.RoughEase",function(e){for(var t,r,i,n,o,a,s=(e=e||{}).taper||"none",l=[],u=0,h=0|(e.points||20),c=h,f=!1!==e.randomize,p=!0===e.clamp,d=e.template instanceof g?e.template:null,m="number"==typeof e.strength?.4*e.strength:.4;-1<--c;)t=f?Math.random():1/h*c,r=d?d.getRatio(t):t,i="none"===s?m:"out"===s?(n=1-t)*n*m:"in"===s?t*t*m:t<.5?(n=2*t)*n*.5*m:(n=2*(1-t))*n*.5*m,f?r+=Math.random()*i-.5*i:c%2?r+=.5*i:r-=.5*i,p&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},m.config=function(e){return new t(e)},t.ease=new t,c("Bounce",u("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),u("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),u("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),c("Circ",u("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),u("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),u("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),c("Elastic",(e=function(e,t,r){var i=l("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),n=i.prototype=new g;return n.constructor=i,n.getRatio=t,n.config=function(e,t){return new i(e,t)},i})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),c("Expo",u("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),u("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),u("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),c("Sine",u("SineOut",function(e){return Math.sin(e*s)}),u("SineIn",function(e){return 1-Math.cos(e*s)}),u("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),l("easing.EaseLookup",{find:function(e){return g.map[e]}},!0),h(n.SlowMo,"SlowMo","ease,"),h(t,"RoughEase","ease,"),h(r,"SteppedEase","ease,"),p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(f,p){"use strict";var d={},i=f.document,m=f.GreenSockGlobals=f.GreenSockGlobals||f,e=m[p];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,n,g,v,o,a,_=function(e){var t,r=e.split("."),i=m;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,r){if(v||g.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var i=this._totalDuration,n=this._timeline;if(io;)n=n._prev;return n?(e._next=n._next,n._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=n,this._recent=e,this._timeline&&this._uncache(!0),this},n._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},n.render=function(e,t,r){var i,n=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;n;)i=n._next,(n._active||e>=n._startTime&&!n._paused&&!n._gc)&&(n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)),n=i},n.rawTime=function(){return v||g.wake(),this._totalTime};var z=k("TweenLite",function(e,t,r){if(M.call(this,t,r),this.render=z.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:z.selector(e)||e;var i,n,o,a=e.jquery||e.length&&e!==f&&e[0]&&(e[0]===f||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?J[z.defaultOverwrite]:"number"==typeof s?s>>0:J[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=l(e),this._propLookup=[],this._siblings=[],i=0;i=$){for(r in $=g.frame+(parseInt(z.autoSleep,10)||120),V){for(e=(t=V[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete V[r]}if((!(r=Q._first)||r._paused)&&z.autoSleep&&!K._first&&1===g._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||g.sleep()}}},g.addEventListener("tick",M._updateRoot);var te=function(e,t,r){var i,n,o=e._gsTweenID;if(V[o||(e._gsTweenID=o="t"+Y++)]||(V[o]={target:e,tweens:[]}),t&&((i=V[o].tweens)[n=i.length]=t,r))for(;-1<--n;)i[n]===t&&i.splice(n,1);return V[o].tweens},re=function(e,t,r,i){var n,o,a=e.vars.onOverwrite;return a&&(n=a(e,t,r,i)),(a=z.onOverwrite)&&(o=a(e,t,r,i)),!1!==n&&!1!==o},ie=function(e,t,r,i,n){var o,a,s,l;if(1===i||4<=i){for(l=n.length,o=0;oh&&((p||!s._initted)&&h-s._startTime<=2e-8||(c[f++]=s)));for(o=f;-1<--o;)if(l=(s=c[o])._firstPT,2===i&&s._kill(r,e,t)&&(a=!0),2!==i||!s._firstPT&&s._initted&&l){if(2!==i&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ne=function(e,t,r){for(var i=e._timeline,n=i._timeScale,o=e._startTime;i._timeline;){if(o+=i._startTime,n*=i._timeScale,i._paused)return-100;i=i._timeline}return t<(o/=n)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/n)>t+y?0:o-t-y};n._init=function(){var e,t,r,i,n,o,a=this.vars,s=this._overwrittenProps,l=this._duration,u=!!a.immediateRender,h=a.ease,c=this._startAt;if(a.startAt){for(i in c&&(c.render(-1,!0),c.kill()),n={},a.startAt)n[i]=a.startAt[i];if(n.data="isStart",n.overwrite=!1,n.immediateRender=!0,n.lazy=u&&!1!==a.lazy,n.startAt=n.delay=null,n.onUpdate=a.onUpdate,n.onUpdateParams=a.onUpdateParams,n.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=z.to(this.target||{},0,n),u)if(0s.pr;)i=i._next;(s._prev=i?i._prev:o)?s._prev._next=s:n=s,(s._next=i)?i._prev=s:o=s,s=a}s=t._firstPT=n}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(G[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,i=e.priority||0,n=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=k("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,i),this._overwriteProps=n||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=f._gsQueue){for(r=0;r>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}f._onUpdate&&(t||(A.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(A.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].timee._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}c._onUpdate&&(t||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0+~]|"+F+")"+F+"*"),W=new RegExp("="+F+"*([^\\]'\"]*?)"+F+"*\\]","g"),q=new RegExp(N),G=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+F+"*(even|odd|(([+-]|)(\\d*)n|)"+F+"*(?:([+-]|)"+F+"*(\\d+)|))"+F+"*\\)|)","i"),bool:new RegExp("^(?:"+z+")$","i"),needsContext:new RegExp("^"+F+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+F+"*((?:-\\d)?\\d*)"+F+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/[+~]/,$=new RegExp("\\\\([\\da-f]{1,6}"+F+"?|("+F+")|.)","ig"),ee=function(e,t,r){var i="0x"+t-65536;return i!=i||r?t:i<0?String.fromCharCode(65536+i):String.fromCharCode(i>>10|55296,1023&i|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){w()},ne=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{M.apply(t=D.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){O.apply(e,D.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}function oe(e,t,r,i){var n,o,a,s,l,u,h,c=t&&t.ownerDocument,f=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==f&&9!==f&&11!==f)return r;if(!i&&((t?t.ownerDocument||t:_)!==T&&w(t),t=t||T,k)){if(11!==f&&(l=K.exec(e)))if(n=l[1]){if(9===f){if(!(a=t.getElementById(n)))return r;if(a.id===n)return r.push(a),r}else if(c&&(a=c.getElementById(n))&&v(t,a)&&a.id===n)return r.push(a),r}else{if(l[2])return M.apply(r,t.getElementsByTagName(e)),r;if((n=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return M.apply(r,t.getElementsByClassName(n)),r}if(p.qsa&&!E[e+" "]&&(!g||!g.test(e))){if(1!==f)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=S),o=(u=d(e)).length;o--;)u[o]="#"+s+" "+ve(u[o]);h=u.join(","),c=Q.test(e)&&me(t.parentNode)||t}if(h)try{return M.apply(r,c.querySelectorAll(h)),r}catch(e){}finally{s===S&&t.removeAttribute("id")}}}return m(e.replace(U,"$1"),t,r,i)}function ae(){var i=[];return function e(t,r){return i.push(t+" ")>b.cacheLength&&delete e[i.shift()],e[t+" "]=r}}function se(e){return e[S]=!0,e}function le(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function he(e,t){var r=t&&e,i=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function pe(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ne(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function de(a){return se(function(o){return o=+o,se(function(e,t){for(var r,i=a([],e.length,o),n=i.length;n--;)e[r=i[n]]&&(e[r]=!(t[r]=e[r]))})})}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in p=oe.support={},n=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,i=e?e.ownerDocument||e:_;return i!==T&&9===i.nodeType&&i.documentElement&&(a=(T=i).documentElement,k=!n(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ie,!1):r.attachEvent&&r.attachEvent("onunload",ie)),p.attributes=le(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=le(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=J.test(T.getElementsByClassName),p.getById=le(function(e){return a.appendChild(e).id=S,!T.getElementsByName||!T.getElementsByName(S).length}),p.getById?(b.filter.ID=function(e){var t=e.replace($,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace($,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r,i,n,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(n=t.getElementsByName(e),i=0;o=n[i++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=p.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):p.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,i=[],n=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;r=o[n++];)1===r.nodeType&&i.push(r);return i},b.find.CLASS=p.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&k)return t.getElementsByClassName(e)},s=[],g=[],(p.qsa=J.test(T.querySelectorAll))&&(le(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+F+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+F+"*(?:value|"+z+")"),e.querySelectorAll("[id~="+S+"-]").length||g.push("~="),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||g.push(".#.+[+~]")}),le(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+F+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(p.matchesSelector=J.test(h=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&le(function(e){p.disconnectedMatch=h.call(e,"*"),h.call(e,"[s!='']:x"),s.push("!=",N)}),g=g.length&&new RegExp(g.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(a.compareDocumentPosition),v=t||J.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},C=t?function(e,t){if(e===t)return u=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:l?R(l,e)-R(l,t):0:4&r?-1:1)}:function(e,t){if(e===t)return u=!0,0;var r,i=0,n=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!n||!o)return e===T?-1:t===T?1:n?-1:o?1:l?R(l,e)-R(l,t):0;if(n===o)return he(e,t);for(r=e;r=r.parentNode;)a.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;a[i]===s[i];)i++;return i?he(a[i],s[i]):a[i]===_?-1:s[i]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(W,"='$1']"),p.matchesSelector&&k&&!E[t+" "]&&(!s||!s.test(t))&&(!g||!g.test(t)))try{var r=h.call(e,t);if(r||p.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,ee),e[3]=(e[3]||e[4]||e[5]||"").replace($,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&q.test(r)&&(t=d(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace($,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=f[e+" "];return t||(t=new RegExp("(^|"+F+")"+e+"("+F+"|$)"))&&f(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,i,n){return function(e){var t=oe.attr(e,r);return null==t?"!="===i:!i||(t+="","="===i?t===n:"!="===i?t!==n:"^="===i?n&&0===t.indexOf(n):"*="===i?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function A(e,r,i){return _(r)?S.grep(e,function(e,t){return!!r.call(e,t,e)!==i}):r.nodeType?S.grep(e,function(e){return e===r!==i}):"string"!=typeof r?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,r){var i,n;if(!e)return this;if(r=r||I,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(S):S.makeArray(e,this);if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!i[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:k,!0)),C.test(i[1])&&S.isPlainObject(t))for(i in t)_(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(n=k.getElementById(i[2]))&&(this[0]=n,this.length=1),this}).prototype=S.fn,I=S(k);var M=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};function R(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}S.fn.extend({has:function(e){var t=S(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ce={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function fe(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?S.merge([e],r):r}function pe(e,t){for(var r=0,i=e.length;rx",v.noCloneChecked=!!de.cloneNode(!0).lastChild.defaultValue;var _e=k.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function ke(){try{return k.activeElement}catch(e){}}function Se(e,t,r,i,n,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof r&&(i=i||r,r=void 0),t)Se(e,s,r,i,t[s],o);return e}if(null==i&&null==n?(n=r,i=r=void 0):null==n&&("string"==typeof r?(n=i,i=void 0):(n=i,i=r,r=void 0)),!1===n)n=Te;else if(!n)return e;return 1===o&&(a=n,(n=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,n,i,r)})}S.event={global:{},add:function(t,e,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.get(t);if(g)for(r.handler&&(r=(o=r).handler,n=o.selector),n&&S.find.matchesSelector(_e,n),r.guid||(r.guid=S.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(z)||[""]).length;u--;)p=m=(s=xe.exec(e[u])||[])[1],d=(s[2]||"").split(".").sort(),p&&(c=S.event.special[p]||{},p=(n?c.delegateType:c.bindType)||p,c=S.event.special[p]||{},h=S.extend({type:p,origType:m,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&S.expr.match.needsContext.test(n),namespace:d.join(".")},o),(f=l[p])||((f=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(t,i,d,a)||t.addEventListener&&t.addEventListener(p,a)),c.add&&(c.add.call(t,h),h.handler.guid||(h.handler.guid=r.guid)),n?f.splice(f.delegateCount++,0,h):f.push(h),S.event.global[p]=!0)},remove:function(e,t,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(u=(t=(t||"").match(z)||[""]).length;u--;)if(p=m=(s=xe.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),p){for(c=S.event.special[p]||{},f=l[p=(i?c.delegateType:c.bindType)||p]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)h=f[o],!n&&m!==h.origType||r&&r.guid!==h.guid||s&&!s.test(h.namespace)||i&&i!==h.selector&&("**"!==i||!h.selector)||(f.splice(o,1),h.selector&&f.delegateCount--,c.remove&&c.remove.call(e,h));a&&!f.length&&(c.teardown&&!1!==c.teardown.call(e,d,g.handle)||S.removeEvent(e,p,g.handle),delete l[p])}else for(p in l)S.event.remove(e,p+t[u],r,i,!0);S.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,r,i,n,o,a,s=S.event.fix(e),l=new Array(arguments.length),u=(Z.get(this,"events")||{})[s.type]||[],h=S.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ee=/\s*$/g;function Ie(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var r,i,n,o,a,s,l,u;if(1===t.nodeType){if(Z.hasData(e)&&(o=Z.access(e),a=Z.set(t,o),u=o.events))for(n in delete a.handle,a.events={},u)for(r=0,i=u[n].length;r")},clone:function(e,t,r){var i,n,o,a,s,l,u,h=e.cloneNode(!0),c=S.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=fe(h),i=0,n=(o=fe(e)).length;i").prop({charset:r.scriptCharset,src:r.url}).on("load error",n=function(e){i.remove(),n=null,e&&t("error"===e.type?404:200,e.type)}),k.head.appendChild(i[0])},abort:function(){n&&n()}}});var Xt,Ht=[],Wt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Ht.pop()||S.expando+"_"+bt++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,r){var i,n,o,a=!1!==e.jsonp&&(Wt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Wt,"$1"+i):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||S.error(i+" was not called"),o[0]},e.dataTypes[0]="json",n=T[i],T[i]=function(){o=arguments},r.always(function(){void 0===n?S(T).removeProp(i):T[i]=n,e[i]&&(e.jsonpCallback=t.jsonpCallback,Ht.push(i)),o&&_(n)&&n(o[0]),o=n=void 0}),"script"}),v.createHTMLDocument=((Xt=k.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),S.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((i=(t=k.implementation.createHTMLDocument("")).createElement("base")).href=k.location.href,t.head.appendChild(i)):t=k),o=!r&&[],(n=C.exec(e))?[t.createElement(n[1])]:(n=ve([e],t,o),o&&o.length&&S(o).remove(),S.merge([],n.childNodes)));var i,n,o},S.fn.load=function(e,t,r){var i,n,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(i):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,r){var i,n,o,a,s,l,u=S.css(e,"position"),h=S(e),c={};"static"===u&&(e.style.position="relative"),s=h.offset(),o=S.css(e,"top"),l=S.css(e,"left"),n=("absolute"===u||"fixed"===u)&&-1<(o+l).indexOf("auto")?(a=(i=h.position()).top,i.left):(a=parseFloat(o)||0,parseFloat(l)||0),_(t)&&(t=t.call(e,r,S.extend({},s))),null!=t.top&&(c.top=t.top-s.top+a),null!=t.left&&(c.left=t.left-s.left+n),"using"in t?t.using.call(e,c):h.css(c)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,r,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),r=i.ownerDocument.defaultView,{top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,i=this[0],n={top:0,left:0};if("fixed"===S.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),r=i.ownerDocument,e=i.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===S.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((n=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),n.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-S.css(i,"marginTop",!0),left:t.left-n.left-S.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===S.css(e,"position");)e=e.offsetParent;return e||_e})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var o="pageYOffset"===n;S.fn[t]=function(e){return X(this,function(e,t,r){var i;if(y(e)?i=e:9===e.nodeType&&(i=e.defaultView),void 0===r)return i?i[n]:e[t];i?i.scrollTo(o?i.pageXOffset:r,o?r:i.pageYOffset):e[t]=r},t,e,arguments.length)}}),S.each(["top","left"],function(e,r){S.cssHooks[r]=Be(v.pixelPosition,function(e,t){if(t)return t=Ne(e,r),Fe.test(t)?S(e).position()[r]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(i,o){S.fn[o]=function(e,t){var r=arguments.length&&(i||"boolean"!=typeof e),n=i||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var i;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(i=e.documentElement,Math.max(e.body["scroll"+a],i["scroll"+a],e.body["offset"+a],i["offset"+a],i["client"+a])):void 0===r?S.css(e,t,n):S.style(e,t,r,n)},s,r?e:void 0,r)}})}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,r){S.fn[r]=function(e,t){return 0>>0,i=(r*=i)>>>0,i+=4294967296*(r-=i)}return 2.3283064365386963e-10*(i>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var r=new o(e),i=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.alea=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],16:[function(e,t,r){!function(e,t,r){function o(e){var n=this,t="";n.next=function(){var e=n.b,t=n.c,r=n.d,i=n.a;return e=e<<25^e>>>7^t,t=t-r|0,r=r<<24^r>>>8^i,i=i-e|0,n.b=e=e<<20^e>>>12^t,n.c=t=t-r|0,n.d=r<<16^t>>>16^i,n.a=i-e|0},n.a=0,n.b=0,n.c=-1640531527,n.d=1367130551,e===Math.floor(e)?(n.a=e/4294967296|0,n.b=0|e):t+=e;for(var r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.tychei=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],17:[function(e,t,r){!function(e,t,r){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var i=0;i>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor128=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],18:[function(e,t,r){!function(e,t,r){function o(e){var o=this;o.next=function(){var e,t,r=o.w,i=o.X,n=o.i;return o.w=r=r+1640531527|0,t=i[n+34&127],e=i[n=n+1&127],t^=t<<13,e^=e<<17,t^=t>>>15,e^=e>>>12,t=i[n]=t^e,o.i=n,t+(r^r>>>16)|0},function(e,t){var r,i,n,o,a,s=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(r=s[127&o]^=i+a)?n+1:0);for(128<=n&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;0>>15,r^=r>>>12,s[n]=i^r;e.w=a,e.X=s,e.i=n}(o,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.X&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor4096=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],19:[function(e,t,r){!function(e,t,r){function o(e){var n=this;n.next=function(){var e,t,r=n.x,i=n.i;return e=r[i],t=(e^=e>>>7)^e<<24,t^=(e=r[i+1&7])^e>>>10,t^=(e=r[i+3&7])^e>>>3,t^=(e=r[i+4&7])^e<<7,e=r[i+7&7],t^=(e^=e<<13)^e<<9,r[i]=t,n.i=i+1&7,t},function(e,t){var r,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.x&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorshift7=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],20:[function(e,t,r){!function(e,t,r){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,e===((t.v=0)|e)?t.x=e:r+=e;for(var i=0;i>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function i(e,t){var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorwow=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],21:[function(t,r,e){!function(s,l){var u,h=this,c=256,f=6,p="random",d=l.pow(c,f),m=l.pow(2,52),g=2*m,v=c-1;function e(e,t,r){var i=[],n=b(function e(t,r){var i,n=[],o=typeof t;if(r&&"object"==o)for(i in t)try{n.push(e(t[i],r-1))}catch(e){}return n.length?n:"string"==o?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(s)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(c):(e=new Uint8Array(c),(h.crypto||h.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=h.navigator,r=t&&t.plugins;return[+new Date,h,r,h.screen,x(s)]}}():e,3),i),o=new _(i),a=function(){for(var e=o.g(f),t=d,r=0;e>>=1;return(e+r)/t};return a.int32=function(){return 0|o.g(4)},a.quick=function(){return o.g(4)/4294967296},a.double=a,b(x(o.S),s),(t.pass||r||function(e,t,r,i){return i&&(i.S&&y(i,o),e.state=function(){return y(o,{})}),r?(l[p]=e,t):e})(a,n,"global"in t?t.global:this==l,t.state)}function _(e){var t,r=e.length,a=this,i=0,n=a.i=a.j=0,o=a.S=[];for(r||(e=[r++]);iMath.PI?c-r:r}function g(e){return e-c*Math.floor(e/c)}t.exports={UP:o,DOWN:a,LEFT:s,RIGHT:0,NORTH:l,SOUTH:u,WEST:h,EAST:0,PI_2:c,PI_QUARTER:f,PI_HALF:p,toDegrees:function(e){return e*i},toRadians:function(e){return e*n},isAngleBetween:function(e,t,r){if(((r-t)%c+c)%c>=Math.PI){var i=t;t=r,r=i}return t<=r?t<=e&&e<=r:t<=e||e<=r},differenceAnglesSign:d,differenceAngles:m,shortestAngle:function(e,t){return m(t,e)*d(t,e)+e},normalize:g,angleTwoPoints:function(){return 4===arguments.length?Math.atan2(arguments[3]-arguments[1],arguments[2]-arguments[0]):Math.atan2(arguments[1].y-arguments[0].y,arguments[1].x-arguments[0].x)},distanceTwoPoints:function(){return 2===arguments.length?Math.sqrt(Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2)):Math.sqrt(Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2))},distanceTwoPointsSquared:function(){return 2===arguments.length?Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2):Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2)},closestAngle:function(e){var t=m(e,s),r=m(e,0),i=m(e,o),n=m(e,a);return t<=r&&t<=i&&t<=n?s:r<=i&&r<=n?0:i<=n?o:a},equals:function(e,t,r){return r?m(e,t)>16)+e*(r>>16)<<16|i*(t>>8&255)+e*(r>>8&255)<<8|i*(255&t)+e*(255&r)},random:function(e,t){function r(){return s.range(e,t)}var i=s.pick([{r:1,g:1,b:1},{r:1,g:1,b:0},{r:1,g:0,b:1},{r:0,g:1,b:1},{r:1,g:0,b:0},{r:0,g:1,b:0},{r:0,g:0,b:1}]);return e=e||0,t=t||255,this.rgbToHex(i.r?r():0,i.g?r():0,i.b?r():0)},randomHSL:function(e,t,r,i,n,o){var a={h:s.range(e,t),s:s.range(r,i,!0),l:s.range(n,o,!0)};return this.hslToHex(a)},randomGoldenRatioHSL:function(e,t,r){for(var i=s.get(1,!0),n=[],o=0;o=this.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.time),this.parent.dirty=!0}if(this.toY){var r=this.toY;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),r.time>=this.time?(this.parent.y=r.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(r.time,r.start,r.delta,this.time),this.parent.dirty=!0}}}},{key:"calcUnderflowX",value:function(){var e=void 0;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}},{key:"calcUnderflowY",value:function(){var e=void 0;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}},{key:"bounce",value:function(){if(!this.paused){var e=void 0,t=this.parent.plugins.decelerate;t&&(t.x||t.y)&&(t.x&&t.percentChangeX===t.friction||t.y&&t.percentChangeY===t.friction)&&(((e=this.parent.OOB()).left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.friction));var r=this.parent.plugins.drag||{},i=this.parent.plugins.pinch||{};if(t=t||{},!(r.active||i.active||this.toX&&this.toY||t.x&&t.y)){var n=(e=e||this.parent.OOB()).cornerPoint;if(!this.toX&&!t.x){var o=null;e.left&&this.left?o=this.parent.screenWorldWidththis.maxWidth&&(this.parent.fitWidth(this.maxWidth),e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})),this.minHeight&&tthis.maxHeight&&(this.parent.fitHeight(this.maxHeight),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}]),i}()},{"./plugin":9}],3:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r(!0===this.right?this.parent.worldWidth:this.right)&&(this.parent.x=-(!0===this.right?this.parent.worldWidth:this.right)*this.parent.scale.x+this.parent.screenWidth,t=!(e.x=0));t&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-x"})}if(null!==this.top||null!==this.bottom){var r=void 0;if(this.parent.screenWorldHeight(!0===this.bottom?this.parent.worldHeight:this.bottom)&&(this.parent.y=-(!0===this.bottom?this.parent.worldHeight:this.bottom)*this.parent.scale.y+this.parent.screenHeight,r=!(e.y=0));r&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-y"})}}}}]),i}()},{"./plugin":9,"./utils":12}],4:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=e-100){var s=e-a.time;this.x=(this.parent.x-a.x)/s,this.y=(this.parent.y-a.y)/s,this.percentChangeX=this.percentChangeY=this.friction;break}}}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}}}},{key:"activate",value:function(e){void 0!==(e=e||{}).x&&(this.x=e.x,this.percentChangeX=this.friction),void 0!==e.y&&(this.y=e.y,this.percentChangeY=this.friction)}},{key:"update",value:function(e){if(!this.paused){var t=void 0;this.x&&(this.parent.x+=this.x*e,this.x*=this.percentChangeX,Math.abs(this.x)this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if("x"!==this.clampWheel)if(this.parent.screenWorldHeightthis.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}},{key:"active",get:function(){return this.moved}}]),i}()},{"./plugin":9,"./utils":12}],6:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.radius))return;var i=Math.atan2(this.target.y-e.y,this.target.x-e.x);t=this.target.x-Math.cos(i)*this.radius,r=this.target.y-Math.sin(i)*this.radius}if(this.speed){var n=t-e.x,o=r-e.y;if(n||o){var a=Math.atan2(r-e.y,t-e.x),s=Math.cos(a)*this.speed,l=Math.sin(a)*this.speed,u=Math.abs(s)>Math.abs(n)?t:e.x+s,h=Math.abs(l)>Math.abs(o)?r:e.y+l;this.parent.moveCenter(u,h),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else this.parent.moveCenter(t,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}}]),n}()},{"./plugin":9}],7:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.radiusSquared){var n=Math.atan2(i.y-r,i.x-t);this.linear?(this.horizontal=Math.round(Math.cos(n))*this.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(n))*this.speed*this.reverse*.06):(this.horizontal=Math.cos(n)*this.speed*this.reverse*.06,this.vertical=Math.sin(n)*this.speed*this.reverse*.06)}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else o.exists(this.left)&&tthis.right?this.horizontal=-1*this.reverse*this.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),o.exists(this.top)&&rthis.bottom?this.vertical=-1*this.reverse*this.speed*.06:(this.decelerateVertical(),this.vertical=0)}}},{key:"decelerateHorizontal",value:function(){var e=this.parent.plugins.decelerate;this.horizontal&&e&&!this.noDecelerate&&e.activate({x:this.horizontal*this.speed*this.reverse/(1e3/60)})}},{key:"decelerateVertical",value:function(){var e=this.parent.plugins.decelerate;this.vertical&&e&&!this.noDecelerate&&e.activate({y:this.vertical*this.speed*this.reverse/(1e3/60)})}},{key:"up",value:function(){this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null}},{key:"update",value:function(){if(!this.paused&&(this.horizontal||this.vertical)){var e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.speed),this.vertical&&(e.y+=this.vertical*this.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}]),i}()},{"./plugin":9,"./utils":12}],8:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.time)this.parent.scale.set(this.x_scale,this.y_scale),this.removeOnComplete&&this.parent.removePlugin("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{var i=this.snapping;this.parent.scale.x=this.ease(i.time,i.startX,i.deltaX,this.time),this.parent.scale.y=this.ease(i.time,i.startY,i.deltaY,this.time)}var n=this.parent.plugins["clamp-zoom"];n&&n.clamp(),this.noMove||(this.center?this.parent.moveCenter(this.center):this.parent.moveCenter(t))}}else this.parent.scale.x===this.x_scale&&this.parent.scale.y===this.y_scale||this.createSnapping()}}},{key:"resume",value:function(){this.snapping=null,function e(t,r,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,r);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,i)}if("value"in n)return n.value;var a=n.get;return void 0!==a?a.call(i):void 0}(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"resume",this).call(this)}}]),i}()},{"./plugin":9,"./utils":12}],11:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.time)r=!0,i=this.startX+this.deltaX,n=this.startY+this.deltaY;else{var o=this.ease(t.time,0,1,this.time);i=this.startX+this.deltaX*o,n=this.startY+this.deltaY*o}this.topLeft?this.parent.moveCorner(i,n):this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),r&&(this.removeOnComplete&&this.parent.removePlugin("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{var a=this.topLeft?this.parent.corner:this.parent.center;a.x===this.x&&a.y===this.y||this.snapStart()}}}]),o}()},{"./plugin":9,"./utils":12}],12:[function(e,t,r){"use strict";var i=e("penner");function n(e){return null!=e}t.exports={exists:n,defaults:function(e,t){return null!=e?e:t},ease:function(e,t){return n(e)?"function"==typeof e?e:"string"==typeof e?i[e]:void 0:i[t]}}},{penner:15}],13:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;r=this.threshold}},{key:"move",value:function(e){if(!this.pause){var t=!0,r=!1,i=void 0;try{for(var n,o=this.pluginsList[Symbol.iterator]();!(t=(n=o.next()).done);t=!0){n.value.move(e)}}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}if(this.clickedAvailable){var a=e.data.global.x-this.last.x,s=e.data.global.y-this.last.y;(this.checkThreshold(a)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}}}},{key:"up",value:function(e){if(!this.pause){if(e.data.originalEvent instanceof MouseEvent&&0==e.data.originalEvent.button&&(this.leftDown=!1),"mouse"!==e.data.pointerType)for(var t=0;tthis._worldWidth,e.top=this.top<0,e.bottom=this.bottom>this._worldHeight,e.cornerPoint={x:this._worldWidth*this.scale.x-this._screenWidth,y:this._worldHeight*this.scale.y-this._screenHeight},e}},{key:"countDownPointers",value:function(){return(this.leftDown?1:0)+this.touches.length}},{key:"getTouchPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t){var i=t[r];-1!==this.touches.indexOf(i.pointerId)&&e.push(i)}return e}},{key:"getPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t)e.push(t[r]);return e}},{key:"_reset",value:function(){this.plugins.bounce&&(this.plugins.bounce.reset(),this.plugins.bounce.bounce()),this.plugins.decelerate&&this.plugins.decelerate.reset(),this.plugins.snap&&this.plugins.snap.reset(),this.plugins.clamp&&this.plugins.clamp.update(),this.plugins["clamp-zoom"]&&this.plugins["clamp-zoom"].clamp(),this.dirty=!0}},{key:"removePlugin",value:function(e){this.plugins[e]&&(this.plugins[e]=null,this.emit(e+"-remove"),this.pluginsSort())}},{key:"pausePlugin",value:function(e){this.plugins[e]&&this.plugins[e].pause()}},{key:"resumePlugin",value:function(e){this.plugins[e]&&this.plugins[e].resume()}},{key:"pluginsSort",value:function(){var e=!0,t=!(this.pluginsList=[]),r=void 0;try{for(var i,n=g[Symbol.iterator]();!(e=(i=n.next()).done);e=!0){var o=i.value;this.plugins[o]&&this.pluginsList.push(this.plugins[o])}}catch(e){t=!0,r=e}finally{try{!e&&n.return&&n.return()}finally{if(t)throw r}}}},{key:"drag",value:function(e){return this.plugins.drag=new o(this,e),this.pluginsSort(),this}},{key:"clamp",value:function(e){return this.plugins.clamp=new s(this,e),this.pluginsSort(),this}},{key:"decelerate",value:function(e){return this.plugins.decelerate=new u(this,e),this.pluginsSort(),this}},{key:"bounce",value:function(e){return this.plugins.bounce=new h(this,e),this.pluginsSort(),this}},{key:"pinch",value:function(e){return this.plugins.pinch=new a(this,e),this.pluginsSort(),this}},{key:"snap",value:function(e,t,r){return this.plugins.snap=new c(this,e,t,r),this.pluginsSort(),this}},{key:"follow",value:function(e,t){return this.plugins.follow=new p(this,e,t),this.pluginsSort(),this}},{key:"wheel",value:function(e){return this.plugins.wheel=new d(this,e),this.pluginsSort(),this}},{key:"clampZoom",value:function(e){return this.plugins["clamp-zoom"]=new l(this,e),this.pluginsSort(),this}},{key:"mouseEdges",value:function(e){return this.plugins["mouse-edges"]=new m(this,e),this.pluginsSort(),this}},{key:"screenWidth",get:function(){return this._screenWidth},set:function(e){this._screenWidth=e}},{key:"screenHeight",get:function(){return this._screenHeight},set:function(e){this._screenHeight=e}},{key:"worldWidth",get:function(){return this._worldWidth?this._worldWidth:this.width},set:function(e){this._worldWidth=e,this.resizePlugins()}},{key:"worldHeight",get:function(){return this._worldHeight?this._worldHeight:this.height},set:function(e){this._worldHeight=e,this.resizePlugins()}},{key:"worldScreenWidth",get:function(){return this._screenWidth/this.scale.x}},{key:"worldScreenHeight",get:function(){return this._screenHeight/this.scale.y}},{key:"screenWorldWidth",get:function(){return this._worldWidth*this.scale.x}},{key:"screenWorldHeight",get:function(){return this._worldHeight*this.scale.y}},{key:"center",get:function(){return{x:this.worldScreenWidth/2-this.x/this.scale.x,y:this.worldScreenHeight/2-this.y/this.scale.y}},set:function(e){this.moveCenter(e)}},{key:"corner",get:function(){return{x:-this.x/this.scale.x,y:-this.y/this.scale.y}},set:function(e){this.moveCorner(e)}},{key:"right",get:function(){return-this.x/this.scale.x+this.worldScreenWidth},set:function(e){this.x=-e*this.scale.x+this.screenWidth,this._reset()}},{key:"left",get:function(){return-this.x/this.scale.x},set:function(e){this.x=-e*this.scale.x,this._reset()}},{key:"top",get:function(){return-this.y/this.scale.y},set:function(e){this.y=-e*this.scale.y,this._reset()}},{key:"bottom",get:function(){return-this.y/this.scale.y+this.worldScreenHeight},set:function(e){this.y=-e*this.scale.y+this.screenHeight,this._reset()}},{key:"dirty",get:function(){return this._dirty},set:function(e){this._dirty=e}},{key:"forceHitArea",get:function(){return this._forceHitArea},set:function(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=!1,this.hitArea=new PIXI.Rectangle(0,0,this.worldWidth,this.worldHeight))}},{key:"pause",get:function(){return this._pause},set:function(e){(this._pause=e)&&(this.touches=[],this.leftDown=!1)}}]),r}();PIXI.extras.Viewport=v,t.exports=v},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;rt&&(r[i]=this.hyphenate(r[i]).join("­"));return r.join("")},t.prototype.hyphenate=function(e){var t,r,i,n,o,a,s,l,u,h=[],c=[],f=e.toLowerCase(),p=Math.max,d=this.trie,m=[""];if(this.exceptions.hasOwnProperty(f))return e.match(this.exceptions[f]).slice(1);if(-1!==e.indexOf("­"))return[e];for(t=(e="_"+e+"_").toLowerCase().split(""),r=e.split(""),s=t.length,i=0;ithis.leftMin&&i@~]/g,"\\$&").replace(/\n/g,"A")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getCommonAncestor=function(e){var t=(1 /g,">").split(/\s+(?=(?:(?:[^"]*"){2})*[^"]*$)/);if(i.length<2)return f("",e,"",t);var n=[i.pop()];for(;1/g,"> ").trim()};var i,n=r(3),h=(i=n)&&i.__esModule?i:{default:i},c=r(0);function f(r,i,n,o){if(r.length&&(r+=" "),n.length&&(n=" "+n),/\[*\]/.test(i)){var e=i.replace(/=.*$/,"]"),a=""+r+e+n;if(g(document.querySelectorAll(a),o))i=e;else for(var s=document.querySelectorAll(""+r+e),t=function(){var t=s[l];if(o.some(function(e){return t.contains(e)})){var e=t.tagName.toLowerCase();return a=""+r+e+n,g(document.querySelectorAll(a),o)&&(i=e),"break"}},l=0,u=s.length;l/.test(i)){var h=i.replace(/>/,"");a=""+r+h+n;g(document.querySelectorAll(a),o)&&(i=h)}if(/:nth-child/.test(i)){var c=i.replace(/nth-child/g,"nth-of-type");a=""+r+c+n;g(document.querySelectorAll(a),o)&&(i=c)}if(/\.\S+\.\S+/.test(i)){for(var f=i.trim().split(".").slice(1).map(function(e){return"."+e}).sort(function(e,t){return e.length-t.length});f.length;){var p=i.replace(f.shift(),"").trim();if(!(a=(""+r+p+n).trim()).length||">"===a.charAt(0)||">"===a.charAt(a.length-1))break;g(document.querySelectorAll(a),o)&&(i=p)}if((f=i&&i.match(/\./g))&&2/.test(s):u=function(t){return function(e){return e(t.parent)&&t.parent}};break;case/^\./.test(s):var r=s.substr(1).split(".");l=function(e){var t=e.attribs.class;return t&&r.every(function(e){return-1)(\S)/g,"$1 $2").trim()),t=i.shift(),n=i.length;return t(this).filter(function(e){for(var t=0;t\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=o.console&&(o.console.warn||o.console.log);return r&&r.call(o.console,n,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===c||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1;rt[r]}):i.sort()),i}function C(e,t){for(var r,i,n=t[0].toUpperCase()+t.slice(1),o=0;of(u.y)?u.x:u.y,t.scale=a?function(e,t){return ie(t[0],t[1],J)/ie(e[0],e[1],J)}(a.pointers,i):1,t.rotation=a?function(e,t){return ne(t[1],t[0],J)+ne(e[1],e[0],J)}(a.pointers,i):0,t.maxPointers=r.prevInput?t.pointers.length>r.prevInput.maxPointers?t.pointers.length:r.prevInput.maxPointers:t.pointers.length,function(e,t){var r,i,n,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=B&&(Ff(h.y)?h.x:h.y,o=re(l,u),e.lastInterval=t}else r=a.velocity,i=a.velocityX,n=a.velocityY,o=a.direction;t.velocity=r,t.velocityX=i,t.velocityY=n,t.direction=o}(r,t);var h=e.element;T(t.srcEvent.target,h)&&(h=t.srcEvent.target);t.target=h}(e,r),e.emit("hammer.input",r),e.recognize(r),e.session.prevInput=r}function $(e){for(var t=[],r=0;r=f(t)?e<0?X:H:t<0?G:W}function ie(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return Math.sqrt(i*i+n*n)}function ne(e,t,r){r||(r=Z);var i=t[r[0]]-e[r[0]],n=t[r[1]]-e[r[1]];return 180*Math.atan2(n,i)/Math.PI}K.prototype={handler:function(){},init:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(O(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(O(this.element),this.evWin,this.domHandler)}};var oe={mousedown:j,mousemove:2,mouseup:N},ae="mousedown",se="mousemove mouseup";function le(){this.evEl=ae,this.evWin=se,this.pressed=!1,K.apply(this,arguments)}v(le,K,{handler:function(e){var t=oe[e.type];t&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=N),this.pressed&&(t&N&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:L,srcEvent:e}))}});var ue={pointerdown:j,pointermove:2,pointerup:N,pointercancel:B,pointerout:B},he={2:z,3:"pen",4:L,5:"kinect"},ce="pointerdown",fe="pointermove pointerup pointercancel";function pe(){this.evEl=ce,this.evWin=fe,K.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(ce="MSPointerDown",fe="MSPointerMove MSPointerUp MSPointerCancel"),v(pe,K,{handler:function(e){var t=this.store,r=!1,i=e.type.toLowerCase().replace("ms",""),n=ue[i],o=he[e.pointerType]||e.pointerType,a=o==z,s=S(t,e.pointerId,"pointerId");n&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):n&(N|B)&&(r=!0),s<0||(t[s]=e,this.callback(this.manager,n,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),r&&t.splice(s,1))}});var de={touchstart:j,touchmove:2,touchend:N,touchcancel:B};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,K.apply(this,arguments)}v(me,K,{handler:function(e){var t=de[e.type];if(t===j&&(this.started=!0),this.started){var r=function(e,t){var r=E(e.touches),i=E(e.changedTouches);t&(N|B)&&(r=A(r.concat(i),"identifier",!0));return[r,i]}.call(this,e,t);t&(N|B)&&r[0].length-r[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:r[0],changedPointers:r[1],pointerType:z,srcEvent:e})}}});var ge={touchstart:j,touchmove:2,touchend:N,touchcancel:B},ve="touchstart touchmove touchend touchcancel";function _e(){this.evTarget=ve,this.targetIds={},K.apply(this,arguments)}v(_e,K,{handler:function(e){var t=ge[e.type],r=function(e,t){var r=E(e.touches),i=this.targetIds;if(t&(2|j)&&1===r.length)return i[r[0].identifier]=!0,[r,r];var n,o,a=E(e.changedTouches),s=[],l=this.target;if(o=r.filter(function(e){return T(e.target,l)}),t===j)for(n=0;nt.threshold&&n&t.direction},attrTest:function(e){return Le.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=Re(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(je,Le,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),v(Ne,Me,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distancet.time;if(this._input=e,!i||!r||e.eventType&(N|B)&&!n)this.reset();else if(e.eventType&j)this.reset(),this._timer=u(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&N)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&N?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}}),v(Be,Le,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),v(Ue,Le,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:q|V,pointers:1},getTouchAction:function(){return Fe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,r=this.options.direction;return r&(q|V)?t=e.overallVelocity:r&q?t=e.overallVelocityX:r&V&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&f(t)>this.options.velocity&&e.eventType&N},emit:function(e){var t=Re(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Xe,Me,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Pe]},process:function(e){var t=this.options,r=e.pointers.length===t.pointers,i=e.distance80*r){i=o=e[0],n=a=e[1];for(var d=r;do.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,h=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,c=G(s,l,t,r,i),f=G(u,h,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=c&&d&&d.z<=f;){if(p!==e.prev&&p!==e.next&&q(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=V(p.prev,p,p.next))return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&q(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=V(d.prev,d,d.next))return!1;d=d.nextZ}for(;p&&p.z>=c;){if(p!==e.prev&&p!==e.next&&q(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=V(p.prev,p,p.next))return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==e.prev&&d!==e.next&&q(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&0<=V(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function B(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!Y(n,o)&&Z(n,i,i.next,o)&&$(n,o)&&$(o,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(o.i/r),re(i),re(i.next),i=e=o),i=i.next}while(i!==e);return L(i)}function U(e,t,r,i,n,o){var a,s,l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&(s=u,(a=l).next.i!==s.i&&a.prev.i!==s.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Z(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(a,s)&&($(a,s)&&$(s,a)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;for(;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,r!==e;);return i}(a,s)&&(V(a.prev,a,s.prev)||V(a,s.prev,s))||Y(a,s)&&0=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&a=i.x&&i.x>=h&&n!==i.x&&q(or.x||i.x===r.x&&(d=i,V((p=r).prev,p,d.prev)<0&&V(d.next,p,p.next)<0)))&&(r=i,f=l)),i=i.next,i!==u;);var p,d;return r}(e,t)){var r=ee(t,e);L(t,t.next),L(r,r.next)}}function G(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function W(e){for(var t=e,r=e;(t.x=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Q(e){return 0= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=_-y,k=Math.floor,P=String.fromCharCode;function S(e){throw RangeError(c[e])}function p(e,t){for(var r=e.length,i=[];r--;)i[r]=t(e[r]);return i}function d(e,t){var r=e.split("@"),i="";return 1>>10&1023|55296),e=56320|1023&e),t+=P(e)}).join("")}function C(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var i=0;for(e=r?k(e/s):e>>1,e+=k(e/t);f*b>>1k((v-d)/a))&&S("overflow"),d+=l*a,!(l<(u=s<=g?y:g+b<=s?b:s-g));s+=_)a>k(v/(h=_-u))&&S("overflow"),a*=h;g=I(d-o,t=f.length+1,0==o),k(d/t)>v-m&&S("overflow"),m+=k(d/t),d%=t,f.splice(d++,0,m)}return A(f)}function g(e){var t,r,i,n,o,a,s,l,u,h,c,f,p,d,m,g=[];for(f=(e=E(e)).length,t=w,o=x,a=r=0;ak((v-r)/(p=i+1))&&S("overflow"),r+=(s-t)*p,t=s,a=0;av&&S("overflow"),c==t){for(l=r,u=_;!(l<(h=u<=o?y:o+b<=u?b:u-o));u+=_)m=l-h,d=_-h,g.push(P(C(h+m%d,0))),l=k(m/d);g.push(P(C(l,0))),o=I(r,p,i==n),r=0,++i}++r,++t}return g.join("")}if(n={version:"1.3.2",ucs2:{decode:E,encode:A},decode:m,encode:g,toASCII:function(e){return d(e,function(e){return u.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return d(e,function(e){return l.test(e)?m(e.slice(4).toLowerCase()):e})}},t&&r)if(O.exports==t)r.exports=n;else for(o in n)n.hasOwnProperty(o)&&(t[o]=n[o]);else e.punycode=n}(D)}),ae={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}};ae.isString,ae.isObject,ae.isNull,ae.isNullOrUndefined;var se=function(e,t,r,i){t=t||"&",r=r||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var s,l,u=e.length;0",'"',"`"," ","\r","\n","\t"]),xe=["'"].concat(be),we=["%","/","?",";","#"].concat(xe),Te=["/","?","#"],ke=/^[+a-z0-9A-Z_-]{0,63}$/,Pe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Se={javascript:!0,"javascript:":!0},Ee={javascript:!0,"javascript:":!0},Ae={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ce(e,t,r){if(e&&ae.isObject(e)&&e instanceof ge)return e;var i=new ge;return i.parse(e,t,r),i}ge.prototype.parse=function(e,t,r){if(!ae.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),n=-1!==i&&i>16&255)/255,t[1]=(e>>8&255)/255,t[2]=(255&e)/255,t}function et(e){var t=e.toString(16);return"#"+(t="000000".substr(0,6-t.length)+t)}function tt(e){return"string"==typeof e&&"#"===e[0]&&(e=e.substr(1)),parseInt(e,16)}var rt=function(){for(var e=[],t=[],r=0;r<32;r++)t[e[r]=r]=r;e[K.BLEND_MODES.NORMAL_NPM]=K.BLEND_MODES.NORMAL,e[K.BLEND_MODES.ADD_NPM]=K.BLEND_MODES.ADD,e[K.BLEND_MODES.SCREEN_NPM]=K.BLEND_MODES.SCREEN,t[K.BLEND_MODES.NORMAL]=K.BLEND_MODES.NORMAL_NPM,t[K.BLEND_MODES.ADD]=K.BLEND_MODES.ADD_NPM,t[K.BLEND_MODES.SCREEN]=K.BLEND_MODES.SCREEN_NPM;var i=[];return i.push(t),i.push(e),i}();function it(e,t){return rt[t?1:0][e]}function nt(e,t,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t):(r[0]=e[0],r[1]=e[1],r[2]=e[2]),r[3]=t,r}function ot(e,t){if(1===t)return(255*t<<24)+e;if(0===t)return 0;var r=e>>16&255,i=e>>8&255,n=255&e;return(255*t<<24)+((r=r*t+.5|0)<<16)+((i=i*t+.5|0)<<8)+(n=n*t+.5|0)}function at(e,t,r,i){return(r=r||new Float32Array(4))[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(255&e)/255,(i||void 0===i)&&(r[0]*=t,r[1]*=t,r[2]*=t),r[3]=t,r}function st(e,t){void 0===t&&(t=null);var r=6*e;if((t=t||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+t.length+" and expected "+r);for(var i=0,n=0;i>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1}function ct(e){return!(e&e-1||!e)}function ft(e){var t=(65535>>=t)?1:0)<<3;return t|=r,t|=r=(15<(e>>>=r)?1:0)<<2,(t|=r=(3<(e>>>=r)?1:0)<<1)|(e>>>=r)>>1}function pt(e,t,r){var i,n=e.length;if(!(n<=t||0===r)){var o=n-(r=n=this.x&&e=this.y&&t=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){if(t>=this.y+this.radius&&t<=this.y+this.height-this.radius||e>=this.x+this.radius&&e<=this.x+this.width-this.radius)return!0;var r=e-(this.x+this.radius),i=t-(this.y+this.radius),n=this.radius*this.radius;if(r*r+i*i<=n)return!0;if((r=e-(this.x+this.width-this.radius))*r+i*i<=n)return!0;if(r*r+(i=t-(this.y+this.height-this.radius))*i<=n)return!0;if((r=e-(this.x+this.radius))*r+i*i<=n)return!0}return!1},e}(),jt=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.copyFrom=function(e){return this.set(e.x,e.y),this},e.prototype.copyTo=function(e){return e.set(this.x,this.y),e},e.prototype.equals=function(e){return e.x===this.x&&e.y===this.y},e.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this.x=e,this.y=t,this},e}(),Nt=function(){function r(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this._x=r,this._y=i,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return void 0===e&&(e=this.cb),void 0===t&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=e),this._x===e&&this._y===t||(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return this._x===e.x&&this._y===e.y||(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),Bt=function(){function t(e,t,r,i,n,o){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=e,this.b=t,this.c=r,this.d=i,this.tx=n,this.ty=o}return t.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},t.prototype.set=function(e,t,r,i,n,o){return this.a=e,this.b=t,this.c=r,this.d=i,this.tx=n,this.ty=o,this},t.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var r=t||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0),r[8]=1,r},t.prototype.apply=function(e,t){t=t||new jt;var r=e.x,i=e.y;return t.x=this.a*r+this.c*i+this.tx,t.y=this.b*r+this.d*i+this.ty,t},t.prototype.applyInverse=function(e,t){t=t||new jt;var r=1/(this.a*this.d+this.c*-this.b),i=e.x,n=e.y;return t.x=this.d*r*i+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,t.y=this.a*r*n+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,t},t.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},t.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},t.prototype.rotate=function(e){var t=Math.cos(e),r=Math.sin(e),i=this.a,n=this.c,o=this.tx;return this.a=i*t-this.b*r,this.b=i*r+this.b*t,this.c=n*t-this.d*r,this.d=n*r+this.d*t,this.tx=o*t-this.ty*r,this.ty=o*r+this.ty*t,this},t.prototype.append=function(e){var t=this.a,r=this.b,i=this.c,n=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*r+e.b*n,this.c=e.c*t+e.d*i,this.d=e.c*r+e.d*n,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*r+e.ty*n+this.ty,this},t.prototype.setTransform=function(e,t,r,i,n,o,a,s,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-s)*o,this.d=Math.cos(a-s)*o,this.tx=e-(r*this.a+i*this.c),this.ty=t-(r*this.b+i*this.d),this},t.prototype.prepend=function(e){var t=this.tx;if(1!==e.a||0!==e.b||0!==e.c||1!==e.d){var r=this.a,i=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},t.prototype.decompose=function(e){var t=this.a,r=this.b,i=this.c,n=this.d,o=-Math.atan2(-i,n),a=Math.atan2(r,t),s=Math.abs(o+a);return s<1e-5||Math.abs(It-s)<1e-5?(e.rotation=a,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=a),e.scale.x=Math.sqrt(t*t+r*r),e.scale.y=Math.sqrt(i*i+n*n),e.position.x=this.tx,e.position.y=this.ty,e},t.prototype.invert=function(){var e=this.a,t=this.b,r=this.c,i=this.d,n=this.tx,o=e*i-t*r;return this.a=i/o,this.b=-t/o,this.c=-r/o,this.d=e/o,this.tx=(r*this.ty-i*n)/o,this.ty=-(e*this.ty-t*n)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),Ut=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Xt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ht=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Gt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Wt=[],qt=[],Vt=Math.sign;!function(){for(var e=0;e<16;e++){var t=[];Wt.push(t);for(var r=0;r<16;r++)for(var i=Vt(Ut[e]*Ut[r]+Ht[e]*Xt[r]),n=Vt(Xt[e]*Ut[r]+Gt[e]*Xt[r]),o=Vt(Ut[e]*Ht[r]+Ht[e]*Gt[r]),a=Vt(Xt[e]*Ht[r]+Gt[e]*Gt[r]),s=0;s<16;s++)if(Ut[s]===i&&Xt[s]===n&&Ht[s]===o&&Gt[s]===a){t.push(s);break}}for(e=0;e<16;e++){var l=new Bt;l.set(Ut[e],Xt[e],Ht[e],Gt[e],0,0),qt.push(l)}}();var Yt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(e){return Ut[e]},uY:function(e){return Xt[e]},vX:function(e){return Ht[e]},vY:function(e){return Gt[e]},inv:function(e){return 8&e?15&e:7&-e},add:function(e,t){return Wt[e][t]},sub:function(e,t){return Wt[e][Yt.inv(t)]},rotate180:function(e){return 4^e},isVertical:function(e){return 2==(3&e)},byDirection:function(e,t){return 2*Math.abs(e)<=Math.abs(t)?0<=t?Yt.S:Yt.N:2*Math.abs(t)<=Math.abs(e)?0this.maxX||this.minY>this.maxY},e.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},e.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?Dt.EMPTY:((e=e||new Dt(0,0,1,1)).x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},e.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},e.prototype.addQuad=function(e){var t=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=e[0],a=e[1];t=oi?e.maxX:i,this.maxY=e.maxY>n?e.maxY:n},e.prototype.addBoundsMask=function(e,t){var r=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,n=e.maxXt.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,n=e.maxXr?this.maxX:r,this.minY=this.minYi?this.maxY:i},e}(),Kt=function(e,t){return(Kt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function Qt(e,t){function r(){this.constructor=e}Kt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $t=function(t){function n(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new Zt,e.alpha=1,e.visible=!0,e.renderable=!0,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Jt,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return Qt(n,t),n.mixin=function(e){for(var t=Object.keys(e),r=0;rthis.children.length)throw new Error(e+"addChildAt: The index "+t+" supplied is out of bounds "+this.children.length);return e.parent&&e.parent.removeChild(e),(e.parent=this).sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e},e.prototype.swapChildren=function(e,t){if(e!==t){var r=this.getChildIndex(e),i=this.getChildIndex(t);this.children[r]=t,this.children[i]=e,this.onChildrenChange(r=this.children.length)throw new Error("The index "+t+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(e);pt(this.children,r,1),this.children.splice(t,0,e),this.onChildrenChange(t)},e.prototype.getChildAt=function(e){if(e<0||e>=this.children.length)throw new Error("getChildAt: Index ("+e+") does not exist.");return this.children[e]},e.prototype.removeChild=function(){for(var e=arguments,t=[],r=0;r title : "+e.title+"
tabIndex: "+e.tabIndex},e.prototype.capHitArea=function(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0),e.x+e.width>this.renderer.width&&(e.width=this.renderer.width-e.x),e.y+e.height>this.renderer.height&&(e.height=this.renderer.height-e.y)},e.prototype.addChild=function(e){var t=this.pool.pop();t||((t=document.createElement("button")).style.width="100px",t.style.height="100px",t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=2..toString(),t.style.borderStyle="none",-1t.priority){e.connect(r);break}t=(r=t).next}e.previous||e.connect(r)}else e.connect(r);return this._startIfPossible(),this},t.prototype.remove=function(e,t){for(var r=this._head.next;r;)r=r.match(e,t)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(t.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),t.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},t.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},t.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},t.prototype.update=function(e){var t;if(void 0===e&&(e=performance.now()),e>this.lastTime){if((t=this.elapsedMS=e-this.lastTime)>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var r=e-this._lastFrame|0;if(r]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,n}(Ar),Dr=function(f){function p(e,t){var r=this;if(t=t||{},!(e instanceof HTMLVideoElement)){var i=document.createElement("video");i.setAttribute("preload","auto"),i.setAttribute("webkit-playsinline",""),i.setAttribute("playsinline",""),"string"==typeof e&&(e=[e]);var n=e[0].src||e[0];Ar.crossOrigin(i,n,t.crossorigin);for(var o=0;othis.baseTexture.width,a=r+n>this.baseTexture.height;if(o||a){var s=o&&a?"and":"or",l="X: "+t+" + "+i+" = "+(t+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: "+l+" "+s+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),l.prototype.castToBaseTexture=function(){return this.baseTexture},l}(I);function Hr(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}Xr.EMPTY=new Xr(new Pr),Hr(Xr.EMPTY),Hr(Xr.EMPTY.baseTexture),Xr.WHITE=function(){var e=document.createElement("canvas");e.width=16,e.height=16;var t=e.getContext("2d");return t.fillStyle="white",t.fillRect(0,0,16,16),new Xr(new Pr(new Cr(e)))}(),Hr(Xr.WHITE),Hr(Xr.WHITE.baseTexture);var Gr=function(l){function t(e,t){var r=this,i=null;if(!(e instanceof Nr)){var n=arguments[1],o=arguments[2],a=arguments[3],s=arguments[4];console.warn("Please use RenderTexture.create("+n+", "+o+") instead of the ctor directly."),i=arguments[0],t=null,e=new Nr({width:n,height:o,scaleMode:a,resolution:s})}return(r=l.call(this,e,t)||this).legacyRenderer=i,r.valid=!0,r.filterFrame=null,r.filterPoolKey=null,r.updateUvs(),r}return xr(t,l),Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,t,r){void 0===r&&(r=!0),e=Math.ceil(e),t=Math.ceil(t),this.valid=0=K.ENV.WEBGL2&&(r=e.getContext("webgl2",t)),r)this.webGLVersion=2;else if(this.webGLVersion=1,!(r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl},e.prototype.getExtensions=function(){var e=this.gl;1===this.webGLVersion?Object.assign(this.extensions,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),loseContext:e.getExtension("WEBGL_lose_context"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,{anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),colorBufferFloat:e.getExtension("EXT_color_buffer_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear")})},e.prototype.handleContextLost=function(e){e.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},e.prototype.destroy=function(){var e=this.renderer.view;e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(e){e.getContextAttributes().stencil||console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var t="WebGL2RenderingContext"in window&&e instanceof window.WebGL2RenderingContext||!!e.getExtension("OES_element_index_uint");(this.supports.uint32Indices=t)||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},e}(Lr),ci=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.multisample=K.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null},fi=new Dt,pi=function(r){function e(e){var t=r.call(this,e)||this;return t.managedFramebuffers=[],t.unknownFramebuffer=new jr(10,10),t.msaaSamples=null,t}return xr(e,r),e.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 Dt,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;C.PREFER_ENV===K.ENV.WEBGL_LEGACY&&(r=t=null),t?e.drawBuffers=function(e){return t.drawBuffersWEBGL(e)}:(this.hasMRT=!1,e.drawBuffers=function(){}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},e.prototype.bind=function(e,t){var r=this.gl;if(e){var i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat!==e.dirtyFormat?(i.dirtyFormat=e.dirtyFormat,this.updateFramebuffer(e)):i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var n=0;n=i.data.byteLength)t.bufferSubData(o,0,i.data);else{var a=i.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=i.data.byteLength,t.bufferData(o,i.data,a)}}}},e.prototype.checkCompatibility=function(e,t){var r=e.attributes,i=t.attributeData;for(var n in i)if(!r[n])throw new Error('shader and geometry incompatible, geometry missing the "'+n+'" attribute')},e.prototype.getSignature=function(e,t){var r=e.attributes,i=t.attributeData,n=["g",e.id];for(var o in r)i[o]&&n.push(o);return n.join("-")},e.prototype.initGeometryVao=function(e,t){this.checkCompatibility(e,t);var r=this.gl,i=this.CONTEXT_UID,n=this.getSignature(e,t),o=e.glVertexArrayObjects[this.CONTEXT_UID],a=o[n];if(a)return o[t.id]=a;var s=e.buffers,l=e.attributes,u={},h={};for(var c in s)u[c]=0,h[c]=0;for(var c in l)!l[c].size&&t.attributeData[c]?l[c].size=t.attributeData[c].size:l[c].size||console.warn("PIXI Geometry attribute '"+c+"' size cannot be determined (likely the bound shader does not have the attribute)"),u[l[c].buffer]+=l[c].size*mi[l[c].type];for(var c in l){var f=l[c],p=f.size;void 0===f.stride&&(u[f.buffer]===p*mi[f.type]?f.stride=0:f.stride=u[f.buffer]),void 0===f.start&&(f.start=h[f.buffer],h[f.buffer]+=p*mi[f.type])}a=r.createVertexArray(),r.bindVertexArray(a);for(var d=0;d=K.ENV.WEBGL2&&(t=e.getContext("webgl2",{})),t||((t=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?t.getExtension("WEBGL_draw_buffers"):t=null),ki=t}return ki}function Si(e,t,r){if("precision"===e.substring(0,9))return r!==K.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e;var i=t;return t===K.PRECISION.HIGH&&r!==K.PRECISION.HIGH&&(i=K.PRECISION.MEDIUM),"precision "+i+" float;\n"+e}var Ei={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};var Ai=null,Ci={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",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Ii(e,t){if(!Ai){var r=Object.keys(Ci);Ai={};for(var i=0;it.name?1:-1});for(a=0;a>=1,r++;this.stateId=e.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},e.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,r=!1,i=0;ithis.maxIdle&&(e.destroyTexture(n,!0),r=!(t[i]=null))}if(r){var o=0;for(i=0;ithis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)},g.prototype.buildTexturesAndDrawCalls=function(){var e=this._bufferedTextures,t=this.MAX_TEXTURES,r=g._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,o=this.renderer.textureGC.count,a=++Pr._globalBatch,s=0,l=r[0],u=0;i.copyBoundTextures(n,t);for(var h=0;h=t&&(i.boundArray(l,n,a,t),this.buildDrawCalls(l,u,h),u=h,l=r[++s],++a),c._batchEnabled=a,c.touched=o,l.elements[l.count++]=c)}0>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-(e.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(var a=0;a=a.length&&a.push(this._generateOneMoreBuffer(e));var d=a[f];d.uploadDynamic(t,c,p);var m=e._bufferUpdateIDs[f]||0;(h=h||d._updateIDthis.maxSegments&&(r=this.maxSegments),r}},mo=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Xr.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Xr.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),go=function(e,t){return(go=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function vo(e,t){function r(){this.constructor=e}go(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var _o={build:function(e){e.points=e.shape.points.slice()},triangulate:function(e,t){var r=e.points,i=e.holes,n=t.points,o=t.indices;if(6<=r.length){for(var a=[],s=0;s>0),v=p/g;if(f+=v,s){a.push(e,t),a.push(r,i);for(var _=1,y=f;_>16)+(65280&t)+((255&t)<<16),r);0>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,e.shader.bind(t),e.geometry.bind(r,t),e.state.set(this.state);for(var s=0,l=a.length;s>16)+(65280&n)+((255&n)<<16)}}},t.prototype.calculateVertices=function(){var e=this.transform._worldID;if(this._transformID!==e){this._transformID=e;for(var t=this.transform.worldTransform,r=t.a,i=t.b,n=t.c,o=t.d,a=t.tx,s=t.ty,l=this._geometry.points,u=this.vertexData,h=0,c=0;c=i&&Vo.x=n&&Vo.y>16)+(65280&e)+((255&e)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture!==e&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=e||Xr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),i}(rr),Jo=function(e,t){return(Jo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};(qo=K.TEXT_GRADIENT||(K.TEXT_GRADIENT={}))[qo.LINEAR_VERTICAL=0]="LINEAR_VERTICAL";var Ko={align:"left",breakWords:!(qo[qo.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"),dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:K.TEXT_GRADIENT.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},Qo=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],$o=function(){function t(e){this.styleID=0,this.reset(),ra(this,e,e)}return t.prototype.clone=function(){var e={};return ra(e,this,Ko),new t(e)},t.prototype.reset=function(){ra(this,Ko,Ko)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(e){var t=ta(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(e){var t=ta(e);this._fill!==t&&(this._fill=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(e){(function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var r=0;r=i&&Sa.x=n&&Sa.y>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;at(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(Ui),ja=function(s){function e(e,t,r){var i=s.call(this)||this,n=new Yr(e),o=new Yr(t,!0),a=new Yr(r,!0,!0);return i.addAttribute("aVertexPosition",n,2,!1,K.TYPES.FLOAT).addAttribute("aTextureCoord",o,2,!1,K.TYPES.FLOAT).addIndex(a),i._updateId=-1,i}return Ma(e,s),Object.defineProperty(e.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),e}(ei),Na=function(e,t){return(Na=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var Ba=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]},Ua=[function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[]};for(var i in t){var n=t[i].match(/^[a-z]+/gm)[0],o=t[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(var s in o){var l=o[s].split("="),u=l[0],h=l[1].replace(/"/gm,""),c=parseFloat(h),f=isNaN(c)?h:c;a[u]=f}r[n].push(a)}var p=new Ba;return r.info.forEach(function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})}),r.common.forEach(function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})}),r.page.forEach(function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})}),r.char.forEach(function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})}),r.kerning.forEach(function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})}),p},e}(),function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new Ba,r=e.getElementsByTagName("info"),i=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),s=0;sl&&(pt(n,1+p-++m,1+v-p),v=p,p=-1,o.push(d),c=Math.max(c,d),f++,i.x=0,i.y+=t.lineHeight,u=null)}}else o.push(h),c=Math.max(c,h),++f,++m,i.x=0,i.y+=t.lineHeight,u=null}var w=a.charAt(a.length-1);"\r"!==w&&"\n"!==w&&(/(?:\s)/.test(w)&&(h=d),o.push(h),c=Math.max(c,h));var T=[];for(v=0;v<=f;v++){var k=0;"right"===this._align?k=c-o[v]:"center"===this._align&&(k=(c-o[v])/2),T.push(k)}var P=n.length,S={},E=[],A=this._activePagesMeshData;for(v=0;v6*M&&!(B.vertices.length<2*La.BATCHABLE_SIZE)||(B.vertices=new Float32Array(8*M),B.uvs=new Float32Array(8*M),B.indices=new Uint16Array(6*M)),B.mesh.size=6*M}for(v=0;v 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",t)||this).alpha=1,e}return function(e,t){function r(){this.constructor=e}Ns(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(e,r),e.prototype._loadMatrix=function(e,t){void 0===t&&(t=!1);var r=e;t&&(this._multiply(r,this.uniforms.m,e),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(e,t,r){return e[0]=t[0]*r[0]+t[1]*r[5]+t[2]*r[10]+t[3]*r[15],e[1]=t[0]*r[1]+t[1]*r[6]+t[2]*r[11]+t[3]*r[16],e[2]=t[0]*r[2]+t[1]*r[7]+t[2]*r[12]+t[3]*r[17],e[3]=t[0]*r[3]+t[1]*r[8]+t[2]*r[13]+t[3]*r[18],e[4]=t[0]*r[4]+t[1]*r[9]+t[2]*r[14]+t[3]*r[19]+t[4],e[5]=t[5]*r[0]+t[6]*r[5]+t[7]*r[10]+t[8]*r[15],e[6]=t[5]*r[1]+t[6]*r[6]+t[7]*r[11]+t[8]*r[16],e[7]=t[5]*r[2]+t[6]*r[7]+t[7]*r[12]+t[8]*r[17],e[8]=t[5]*r[3]+t[6]*r[8]+t[7]*r[13]+t[8]*r[18],e[9]=t[5]*r[4]+t[6]*r[9]+t[7]*r[14]+t[8]*r[19]+t[9],e[10]=t[10]*r[0]+t[11]*r[5]+t[12]*r[10]+t[13]*r[15],e[11]=t[10]*r[1]+t[11]*r[6]+t[12]*r[11]+t[13]*r[16],e[12]=t[10]*r[2]+t[11]*r[7]+t[12]*r[12]+t[13]*r[17],e[13]=t[10]*r[3]+t[11]*r[8]+t[12]*r[13]+t[13]*r[18],e[14]=t[10]*r[4]+t[11]*r[9]+t[12]*r[14]+t[13]*r[19]+t[14],e[15]=t[15]*r[0]+t[16]*r[5]+t[17]*r[10]+t[18]*r[15],e[16]=t[15]*r[1]+t[16]*r[6]+t[17]*r[11]+t[18]*r[16],e[17]=t[15]*r[2]+t[16]*r[7]+t[17]*r[12]+t[18]*r[17],e[18]=t[15]*r[3]+t[16]*r[8]+t[17]*r[13]+t[18]*r[18],e[19]=t[15]*r[4]+t[16]*r[9]+t[17]*r[14]+t[18]*r[19]+t[19],e},e.prototype._colorMatrix=function(e){var t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t},e.prototype.brightness=function(e,t){var r=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.greyscale=function(e,t){var r=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.blackAndWhite=function(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)},e.prototype.hue=function(e,t){e=(e||0)/180*Math.PI;var r=Math.cos(e),i=Math.sin(e),n=(0,Math.sqrt)(1/3),o=[r+1/3*(1-r),1/3*(1-r)-n*i,1/3*(1-r)+n*i,0,0,1/3*(1-r)+n*i,r+1/3*(1-r),1/3*(1-r)-n*i,0,0,1/3*(1-r)-n*i,1/3*(1-r)+n*i,r+1/3*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,t)},e.prototype.contrast=function(e,t){var r=(e||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,t)},e.prototype.saturate=function(e,t){void 0===e&&(e=0);var r=2*e/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,t)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)},e.prototype.sepia=function(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)},e.prototype.technicolor=function(e){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],e)},e.prototype.polaroid=function(e){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],e)},e.prototype.toBGR=function(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)},e.prototype.kodachrome=function(e){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],e)},e.prototype.browni=function(e){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],e)},e.prototype.vintage=function(e){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],e)},e.prototype.colorTone=function(e,t,r,i,n){var o=((r=r||16770432)>>16&255)/255,a=(r>>8&255)/255,s=(255&r)/255,l=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,h=(255&i)/255,c=[.3,.59,.11,0,0,o,a,s,e=e||.2,0,l,u,h,t=t||.15,0,o-l,a-u,s-h,0,0];this._loadMatrix(c,n)},e.prototype.night=function(e,t){var r=[-2*(e=e||.1),-e,0,0,0,-e,0,e,0,0,0,e,2*e,0,0,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.predator=function(e,t){var r=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(r,t)},e.prototype.lsd=function(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)},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)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(e){this.uniforms.m=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(e){this.uniforms.uAlpha=e},enumerable:!1,configurable:!0}),e}(Hi);Bs.prototype.grayscale=Bs.prototype.greyscale;var Us=function(e,t){return(Us=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var Xs=function(n){function e(e,t){var r=this,i=new Bt;return e.renderable=!1,(r=n.call(this,"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","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",{mapSampler:e._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,r.maskMatrix=i,null==t&&(t=20),r.scale=new jt(t,t),r}return function(e,t){function r(){this.constructor=e}Us(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(e,n),e.prototype.apply=function(e,t,r,i){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),a=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==a&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/a,this.uniforms.rotation[3]=n.d/a),e.applyFilter(this,t,r,i)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(e){this.uniforms.mapSampler=e},enumerable:!1,configurable:!0}),e}(Hi),Hs=function(e,t){return(Hs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var Gs=function(e){function t(){return e.call(this,"\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",'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')||this}return function(e,t){function r(){this.constructor=e}Hs(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t}(Hi),Ws=function(e,t){return(Ws=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var qs=function(i){function e(e,t){void 0===e&&(e=.5),void 0===t&&(t=Math.random());var r=i.call(this,_n,"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",{uNoise:0,uSeed:0})||this;return r.noise=e,r.seed=t,r}return function(e,t){function r(){this.constructor=e}Ws(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(e,i),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(e){this.uniforms.uNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(e){this.uniforms.uSeed=e},enumerable:!1,configurable:!0}),e}(Hi),Vs=new Bt;$t.prototype._cacheAsBitmap=!1,$t.prototype._cacheData=null;var Ys=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties($t.prototype,{cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(e){var t;this._cacheAsBitmap!==e&&((this._cacheAsBitmap=e)?(this._cacheData||(this._cacheData=new Ys),(t=this._cacheData).originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((t=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea))}}}),$t.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},$t.prototype._initCachedDisplayObject=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.alpha;this.alpha=1,e.batch.flush();var r=this.getLocalBounds(null,!0).clone();if(this.filters){var i=this.filters[0].padding;r.pad(i)}r.ceil(C.RESOLUTION);var n=e.renderTexture.current,o=e.renderTexture.sourceFrame.clone(),a=e.projection.transform,s=Gr.create({width:r.width,height:r.height}),l="cacheAsBitmap_"+gt();this._cacheData.textureCacheId=l,Pr.addToCache(s.baseTexture,l),Xr.addToCache(s,l);var u=this.transform.localTransform.copyTo(Vs).invert().translate(-r.x,-r.y);this.render=this._cacheData.originalRender,e.render(this,s,!0,u,!1),e.projection.transform=a,e.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 h=new Zo(s);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-r.x/r.width,h.anchor.y=-r.y/r.height,h.alpha=t,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=h.containsPoint.bind(h)}},$t.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},$t.prototype._initCachedDisplayObjectCanvas=function(e){if(!this._cacheData||!this._cacheData.sprite){var t=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;var i=e.context,n=e._projTransform;t.ceil(C.RESOLUTION);var o=Gr.create({width:t.width,height:t.height}),a="cacheAsBitmap_"+gt();this._cacheData.textureCacheId=a,Pr.addToCache(o.baseTexture,a),Xr.addToCache(o,a);var s=Vs;this.transform.localTransform.copyTo(s),s.invert(),s.tx-=t.x,s.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,o,!0,s,!1),e.context=i,e._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null;var l=new Zo(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-t.x/t.width,l.anchor.y=-t.y/t.height,l.alpha=r,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)}},$t.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},$t.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},$t.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,Pr.removeFromCache(this._cacheData.textureCacheId),Xr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},$t.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},$t.prototype.name=null,rr.prototype.getChildByName=function(e,t){for(var r=0,i=this.children.length;re?1:this._width/e,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(t,i)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(e){this._leftWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(e){this._rightWidth=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(e){this._topHeight=e,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(e){this._bottomHeight=e,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;var r=1/this._origWidth,i=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(il),al=function(e,t){return(al=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};var sl=function(i){function n(e,t){void 0===t&&(t=!0);var r=i.call(this,e[0]instanceof Xr?e[0]:e[0].texture)||this;return r._textures=null,r._durations=null,r._autoUpdate=t,r._isConnectedToTicker=!1,r.animationSpeed=1,r.loop=!0,r.updateAnchor=!1,r.onComplete=null,r.onFrameChange=null,r.onLoop=null,r._currentTime=0,r._playing=!1,r._previousFrame=null,r.textures=e,r}return function(e,t){function r(){this.constructor=e}al(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(n,i),n.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(sr.shared.remove(this.update,this),this._isConnectedToTicker=!1))},n.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(sr.shared.add(this.update,this,K.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},n.prototype.gotoAndStop=function(e){this.stop();var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()},n.prototype.gotoAndPlay=function(e){var t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture(),this.play()},n.prototype.update=function(e){var t=this.animationSpeed*e,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=t/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*e);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+=t;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&&(0r&&this.onLoop()),this.updateTexture())},n.prototype.updateTexture=function(){var e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],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))},n.prototype.destroy=function(e){this.stop(),i.prototype.destroy.call(this,e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},n.fromFrames=function(e){for(var t=[],r=0;r 0) var gc = undefined");else{if(!ba&&!ca)throw"Unknown runtime environment. Where are we?";e.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},"undefined"!=typeof arguments&&(e.arguments=arguments),"undefined"!=typeof console?(e.print||(e.print=function(e){console.log(e)}),e.printErr||(e.printErr=function(e){console.log(e)})):e.print||(e.print=function(){}),ca&&(e.load=importScripts),void 0===e.setWindowTitle&&(e.setWindowTitle=function(e){document.title=e})}function ha(e){eval.call(null,e)}for(k in!e.load&&e.read&&(e.load=function(t){ha(e.read(t))}),e.print||(e.print=function(){}),e.printErr||(e.printErr=e.print),e.arguments||(e.arguments=[]),e.thisProgram||(e.thisProgram="./this.program"),e.print=e.print,e.W=e.printErr,e.preRun=[],e.postRun=[],aa)aa.hasOwnProperty(k)&&(e[k]=aa[k]);var n={rb:function(e){ka=e},fb:function(){return ka},ua:function(){return m},ba:function(e){m=e},Ka:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:return"*"===e[e.length-1]?n.J:"i"===e[0]?(assert(0==(e=parseInt(e.substr(1)))%8),e/8):0}},eb:function(e){return Math.max(n.Ka(e),n.J)},ud:16,Qd:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4==(7&e)),e+=4):assert(0==(3&e)),e},Ed:function(e,t,r){return r||"i64"!=e&&"double"!=e?e?Math.min(t||(e?n.eb(e):0),n.J):Math.min(t,8):8},L:function(t,r,i){return i&&i.length?(i.splice||(i=Array.prototype.slice.call(i)),i.splice(0,0,r),e["dynCall_"+t].apply(null,i)):e["dynCall_"+t].call(null,r)},Z:[],Xa:function(e){for(var t=0;t>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t)},Ua:8,J:4,vd:0};e.Runtime=n,n.addFunction=n.Xa,n.removeFunction=n.nb;var na=!1,oa,pa,ka,ra,sa;function assert(e,t){e||x("Assertion failed: "+t)}function qa(a){var b=e["_"+a];if(!b)try{b=eval("_"+a)}catch(e){}return assert(b,"Cannot call unknown function "+a+" (perhaps LLVM optimizations or closure removed it?)"),b}function wa(e,t,r){switch("*"===(r=r||"i8").charAt(r.length-1)&&(r="i32"),r){case"i1":case"i8":y[e>>0]=t;break;case"i16":z[e>>1]=t;break;case"i32":C[e>>2]=t;break;case"i64":pa=[t>>>0,(oa=t,1<=+xa(oa)?0>>0:~~+Aa((oa-+(~~oa>>>0))/4294967296)>>>0:0)],C[e>>2]=pa[0],C[e+4>>2]=pa[1];break;case"float":Ba[e>>2]=t;break;case"double":Ca[e>>3]=t;break;default:x("invalid type for setValue: "+r)}}function Da(e,t){switch("*"===(t=t||"i8").charAt(t.length-1)&&(t="i32"),t){case"i1":case"i8":return y[e>>0];case"i16":return z[e>>1];case"i32":case"i64":return C[e>>2];case"float":return Ba[e>>2];case"double":return Ca[e>>3];default:x("invalid type for setValue: "+t)}return null}function D(e,t,r,i){var o,a;a="number"==typeof e?(o=!0,e):(o=!1,e.length);var s,l,u="string"==typeof t?t:null;if(r=4==r?i:[Ea,n.aa,n.Ra,n.R][void 0===r?2:r](Math.max(a,u?1:t.length)),o){for(assert(0==(3&(i=r))),e=r+(-4&a);i>2]=0;for(e=r+a;i>0]=0;return r}if("i8"===u)return e.subarray||e.slice?E.set(e,r):E.set(new Uint8Array(e),r),r;for(i=0;i>0],0!=i||r)&&(o++,!r||o!=r););if(r||(r=o),i="",n<128){for(;0>10,56320|1023&r)))):s+=String.fromCharCode(r)}}function Ka(e,t,r,i){if(!(0>6}else{if(a<=65535){if(i<=r+2)break;t[r++]=224|a>>12}else{if(a<=2097151){if(i<=r+3)break;t[r++]=240|a>>18}else{if(a<=67108863){if(i<=r+4)break;t[r++]=248|a>>24}else{if(i<=r+5)break;t[r++]=252|a>>30,t[r++]=128|a>>24&63}t[r++]=128|a>>18&63}t[r++]=128|a>>12&63}t[r++]=128|a>>6&63}t[r++]=128|63&a}}return t[r]=0,r-n}function La(e){for(var t=0,r=0;r"):o=n;e:for(;c>0];if(!r)return t;t+=String.fromCharCode(r)}},e.stringToAscii=function(e,t){return Ia(e,t,!1)},e.UTF8ArrayToString=Ja,e.UTF8ToString=function(e){return Ja(E,e)},e.stringToUTF8Array=Ka,e.stringToUTF8=function(e,t,r){return Ka(e,E,t,r)},e.lengthBytesUTF8=La,e.UTF16ToString=function(e){for(var t=0,r="";;){var i=z[e+2*t>>1];if(0==i)return r;++t,r+=String.fromCharCode(i)}},e.stringToUTF16=function(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;var i=t;r=(r-=2)<2*e.length?r/2:e.length;for(var n=0;n>1]=e.charCodeAt(n),t+=2;return z[t>>1]=0,t-i},e.lengthBytesUTF16=function(e){return 2*e.length},e.UTF32ToString=function(e){for(var t=0,r="";;){var i=C[e+4*t>>2];if(0==i)return r;++t,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}},e.stringToUTF32=function(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;var i=t;r=i+r-4;for(var n=0;n>2]=o,r<(t+=4)+4)break}return C[t>>2]=0,t-i},e.lengthBytesUTF32=function(e){for(var t=0,r=0;r>0]=e[r],r+=1}function ta(e,t){for(var r=0;r>0]=e[r]}function Ia(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(y[t>>0]=0)}e.addOnPreRun=fb,e.addOnInit=function(e){cb.unshift(e)},e.addOnPreMain=function(e){db.unshift(e)},e.addOnExit=function(e){H.unshift(e)},e.addOnPostRun=gb,e.intArrayFromString=hb,e.intArrayToString=function(e){for(var t=[],r=0;r>>16)*i+r*(t>>>16)<<16)|0}),Math.Jd=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.Ad=Math.clz32;var xa=Math.abs,Aa=Math.ceil,za=Math.floor,ya=Math.min,I=0,ib=null,jb=null;function kb(){I++,e.monitorRunDependencies&&e.monitorRunDependencies(I)}function lb(){if(I--,e.monitorRunDependencies&&e.monitorRunDependencies(I),0==I&&(null!==ib&&(clearInterval(ib),ib=null),jb)){var t=jb;jb=null,t()}}e.addRunDependency=kb,e.removeRunDependency=lb,e.preloadedImages={},e.preloadedAudios={},Ta=8,la=Ta+5888,cb.push(),D([124,0,0,0,98,7,0,0,124,0,0,0,111,7,0,0,164,0,0,0,124,7,0,0,16,0,0,0,0,0,0,0,164,0,0,0,157,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,227,7,0,0,24,0,0,0,0,0,0,0,164,0,0,0,191,7,0,0,56,0,0,0,0,0,0,0,164,0,0,0,5,8,0,0,40,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,40,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,88,0,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,114,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,1,0,0,236,1,0,0,236,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0,239,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,231,16,0,0,0,4,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,115,40,37,117,41,58,32,65,115,115,101,114,116,105,111,110,32,102,97,105,108,117,114,101,58,32,34,37,115,34,10,0,109,95,115,105,122,101,32,60,61,32,109,95,99,97,112,97,99,105,116,121,0,46,47,99,114,110,95,100,101,99,111,109,112,46,104,0,109,105,110,95,110,101,119,95,99,97,112,97,99,105,116,121,32,60,32,40,48,120,55,70,70,70,48,48,48,48,85,32,47,32,101,108,101,109,101,110,116,95,115,105,122,101,41,0,110,101,119,95,99,97,112,97,99,105,116,121,32,38,38,32,40,110,101,119,95,99,97,112,97,99,105,116,121,32,62,32,109,95,99,97,112,97,99,105,116,121,41,0,110,117,109,95,99,111,100,101,115,91,99,93,0,115,111,114,116,101,100,95,112,111,115,32,60,32,116,111,116,97,108,95,117,115,101,100,95,115,121,109,115,0,112,67,111,100,101,115,105,122,101,115,91,115,121,109,95,105,110,100,101,120,93,32,61,61,32,99,111,100,101,115,105,122,101,0,116,32,60,32,40,49,85,32,60,60,32,116,97,98,108,101,95,98,105,116,115,41,0,109,95,108,111,111,107,117,112,91,116,93,32,61,61,32,99,85,73,78,84,51,50,95,77,65,88,0,99,114,110,100,95,109,97,108,108,111,99,58,32,115,105,122,101,32,116,111,111,32,98,105,103,0,99,114,110,100,95,109,97,108,108,111,99,58,32,111,117,116,32,111,102,32,109,101,109,111,114,121,0,40,40,117,105,110,116,51,50,41,112,95,110,101,119,32,38,32,40,67,82,78,68,95,77,73,78,95,65,76,76,79,67,95,65,76,73,71,78,77,69,78,84,32,45,32,49,41,41,32,61,61,32,48,0,99,114,110,100,95,114,101,97,108,108,111,99,58,32,98,97,100,32,112,116,114,0,99,114,110,100,95,102,114,101,101,58,32,98,97,100,32,112,116,114,0,102,97,108,115,101,0,40,116,111,116,97,108,95,115,121,109,115,32,62,61,32,49,41,32,38,38,32,40,116,111,116,97,108,95,115,121,109,115,32,60,61,32,112,114,101,102,105,120,95,99,111,100,105,110,103,58,58,99,77,97,120,83,117,112,112,111,114,116,101,100,83,121,109,115,41,0,17,18,19,20,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15,16,48,0,110,117,109,95,98,105,116,115,32,60,61,32,51,50,85,0,109,95,98,105,116,95,99,111,117,110,116,32,60,61,32,99,66,105,116,66,117,102,83,105,122,101,0,116,32,33,61,32,99,85,73,78,84,51,50,95,77,65,88,0,109,111,100,101,108,46,109,95,99,111,100,101,95,115,105,122,101,115,91,115,121,109,93,32,61,61,32,108,101,110,0,0,2,3,1,0,2,3,4,5,6,7,1,40,108,101,110,32,62,61,32,49,41,32,38,38,32,40,108,101,110,32,60,61,32,99,77,97,120,69,120,112,101,99,116,101,100,67,111,100,101,83,105,122,101,41,0,105,32,60,32,109,95,115,105,122,101,0,110,101,120,116,95,108,101,118,101,108,95,111,102,115,32,62,32,99,117,114,95,108,101,118,101,108,95,111,102,115,0,1,2,2,3,3,3,3,4,0,0,0,0,0,0,1,1,0,1,0,1,0,0,1,2,1,2,0,0,0,1,0,2,1,0,2,0,0,1,2,3,110,117,109,32,38,38,32,40,110,117,109,32,61,61,32,126,110,117,109,95,99,104,101,99,107,41,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,112,116,104,114,101,97,100,95,111,110,99,101,32,102,97,105,108,117,114,101,32,105,110,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,95,102,97,115,116,40,41,0,116,101,114,109,105,110,97,116,101,95,104,97,110,100,108,101,114,32,117,110,101,120,112,101,99,116,101,100,108,121,32,114,101,116,117,114,110,101,100,0,99,97,110,110,111,116,32,99,114,101,97,116,101,32,112,116,104,114,101,97,100,32,107,101,121,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,99,97,110,110,111,116,32,122,101,114,111,32,111,117,116,32,116,104,114,101,97,100,32,118,97,108,117,101,32,102,111,114,32,95,95,99,120,97,95,103,101,116,95,103,108,111,98,97,108,115,40,41,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,58,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,101,120,99,101,112,116,105,111,110,32,111,102,32,116,121,112,101,32,37,115,0,116,101,114,109,105,110,97,116,105,110,103,32,119,105,116,104,32,37,115,32,102,111,114,101,105,103,110,32,101,120,99,101,112,116,105,111,110,0,116,101,114,109,105,110,97,116,105,110,103,0,117,110,99,97,117,103,104,116,0,84,33,34,25,13,1,2,3,17,75,28,12,16,4,11,29,18,30,39,104,110,111,112,113,98,32,5,6,15,19,20,21,26,8,22,7,40,36,23,24,9,10,14,27,31,37,35,131,130,125,38,42,43,60,61,62,63,67,71,74,77,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,105,106,107,108,114,115,116,121,122,123,124,0,73,108,108,101,103,97,108,32,98,121,116,101,32,115,101,113,117,101,110,99,101,0,68,111,109,97,105,110,32,101,114,114,111,114,0,82,101,115,117,108,116,32,110,111,116,32,114,101,112,114,101,115,101,110,116,97,98,108,101,0,78,111,116,32,97,32,116,116,121,0,80,101,114,109,105,115,115,105,111,110,32,100,101,110,105,101,100,0,79,112,101,114,97,116,105,111,110,32,110,111,116,32,112,101,114,109,105,116,116,101,100,0,78,111,32,115,117,99,104,32,102,105,108,101,32,111,114,32,100,105,114,101,99,116,111,114,121,0,78,111,32,115,117,99,104,32,112,114,111,99,101,115,115,0,70,105,108,101,32,101,120,105,115,116,115,0,86,97,108,117,101,32,116,111,111,32,108,97,114,103,101,32,102,111,114,32,100,97,116,97,32,116,121,112,101,0,78,111,32,115,112,97,99,101,32,108,101,102,116,32,111,110,32,100,101,118,105,99,101,0,79,117,116,32,111,102,32,109,101,109,111,114,121,0,82,101,115,111,117,114,99,101,32,98,117,115,121,0,73,110,116,101,114,114,117,112,116,101,100,32,115,121,115,116,101,109,32,99,97,108,108,0,82,101,115,111,117,114,99,101,32,116,101,109,112,111,114,97,114,105,108,121,32,117,110,97,118,97,105,108,97,98,108,101,0,73,110,118,97,108,105,100,32,115,101,101,107,0,67,114,111,115,115,45,100,101,118,105,99,101,32,108,105,110,107,0,82,101,97,100,45,111,110,108,121,32,102,105,108,101,32,115,121,115,116,101,109,0,68,105,114,101,99,116,111,114,121,32,110,111,116,32,101,109,112,116,121,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,112,101,101,114,0,79,112,101,114,97,116,105,111,110,32,116,105,109,101,100,32,111,117,116,0,67,111,110,110,101,99,116,105,111,110,32,114,101,102,117,115,101,100,0,72,111,115,116,32,105,115,32,100,111,119,110,0,72,111,115,116,32,105,115,32,117,110,114,101,97,99,104,97,98,108,101,0,65,100,100,114,101,115,115,32,105,110,32,117,115,101,0,66,114,111,107,101,110,32,112,105,112,101,0,73,47,79,32,101,114,114,111,114,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,32,111,114,32,97,100,100,114,101,115,115,0,66,108,111,99,107,32,100,101,118,105,99,101,32,114,101,113,117,105,114,101,100,0,78,111,32,115,117,99,104,32,100,101,118,105,99,101,0,78,111,116,32,97,32,100,105,114,101,99,116,111,114,121,0,73,115,32,97,32,100,105,114,101,99,116,111,114,121,0,84,101,120,116,32,102,105,108,101,32,98,117,115,121,0,69,120,101,99,32,102,111,114,109,97,116,32,101,114,114,111,114,0,73,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,65,114,103,117,109,101,110,116,32,108,105,115,116,32,116,111,111,32,108,111,110,103,0,83,121,109,98,111,108,105,99,32,108,105,110,107,32,108,111,111,112,0,70,105,108,101,110,97,109,101,32,116,111,111,32,108,111,110,103,0,84,111,111,32,109,97,110,121,32,111,112,101,110,32,102,105,108,101,115,32,105,110,32,115,121,115,116,101,109,0,78,111,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,115,32,97,118,97,105,108,97,98,108,101,0,66,97,100,32,102,105,108,101,32,100,101,115,99,114,105,112,116,111,114,0,78,111,32,99,104,105,108,100,32,112,114,111,99,101,115,115,0,66,97,100,32,97,100,100,114,101,115,115,0,70,105,108,101,32,116,111,111,32,108,97,114,103,101,0,84,111,111,32,109,97,110,121,32,108,105,110,107,115,0,78,111,32,108,111,99,107,115,32,97,118,97,105,108,97,98,108,101,0,82,101,115,111,117,114,99,101,32,100,101,97,100,108,111,99,107,32,119,111,117,108,100,32,111,99,99,117,114,0,83,116,97,116,101,32,110,111,116,32,114,101,99,111,118,101,114,97,98,108,101,0,80,114,101,118,105,111,117,115,32,111,119,110,101,114,32,100,105,101,100,0,79,112,101,114,97,116,105,111,110,32,99,97,110,99,101,108,101,100,0,70,117,110,99,116,105,111,110,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,78,111,32,109,101,115,115,97,103,101,32,111,102,32,100,101,115,105,114,101,100,32,116,121,112,101,0,73,100,101,110,116,105,102,105,101,114,32,114,101,109,111,118,101,100,0,68,101,118,105,99,101,32,110,111,116,32,97,32,115,116,114,101,97,109,0,78,111,32,100,97,116,97,32,97,118,97,105,108,97,98,108,101,0,68,101,118,105,99,101,32,116,105,109,101,111,117,116,0,79,117,116,32,111,102,32,115,116,114,101,97,109,115,32,114,101,115,111,117,114,99,101,115,0,76,105,110,107,32,104,97,115,32,98,101,101,110,32,115,101,118,101,114,101,100,0,80,114,111,116,111,99,111,108,32,101,114,114,111,114,0,66,97,100,32,109,101,115,115,97,103,101,0,70,105,108,101,32,100,101,115,99,114,105,112,116,111,114,32,105,110,32,98,97,100,32,115,116,97,116,101,0,78,111,116,32,97,32,115,111,99,107,101,116,0,68,101,115,116,105,110,97,116,105,111,110,32,97,100,100,114,101,115,115,32,114,101,113,117,105,114,101,100,0,77,101,115,115,97,103,101,32,116,111,111,32,108,97,114,103,101,0,80,114,111,116,111,99,111,108,32,119,114,111,110,103,32,116,121,112,101,32,102,111,114,32,115,111,99,107,101,116,0,80,114,111,116,111,99,111,108,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,80,114,111,116,111,99,111,108,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,83,111,99,107,101,116,32,116,121,112,101,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,78,111,116,32,115,117,112,112,111,114,116,101,100,0,80,114,111,116,111,99,111,108,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,0,65,100,100,114,101,115,115,32,102,97,109,105,108,121,32,110,111,116,32,115,117,112,112,111,114,116,101,100,32,98,121,32,112,114,111,116,111,99,111,108,0,65,100,100,114,101,115,115,32,110,111,116,32,97,118,97,105,108,97,98,108,101,0,78,101,116,119,111,114,107,32,105,115,32,100,111,119,110,0,78,101,116,119,111,114,107,32,117,110,114,101,97,99,104,97,98,108,101,0,67,111,110,110,101,99,116,105,111,110,32,114,101,115,101,116,32,98,121,32,110,101,116,119,111,114,107,0,67,111,110,110,101,99,116,105,111,110,32,97,98,111,114,116,101,100,0,78,111,32,98,117,102,102,101,114,32,115,112,97,99,101,32,97,118,97,105,108,97,98,108,101,0,83,111,99,107,101,116,32,105,115,32,99,111,110,110,101,99,116,101,100,0,83,111,99,107,101,116,32,110,111,116,32,99,111,110,110,101,99,116,101,100,0,67,97,110,110,111,116,32,115,101,110,100,32,97,102,116,101,114,32,115,111,99,107,101,116,32,115,104,117,116,100,111,119,110,0,79,112,101,114,97,116,105,111,110,32,97,108,114,101,97,100,121,32,105,110,32,112,114,111,103,114,101,115,115,0,79,112,101,114,97,116,105,111,110,32,105,110,32,112,114,111,103,114,101,115,115,0,83,116,97,108,101,32,102,105,108,101,32,104,97,110,100,108,101,0,82,101,109,111,116,101,32,73,47,79,32,101,114,114,111,114,0,81,117,111,116,97,32,101,120,99,101,101,100,101,100,0,78,111,32,109,101,100,105,117,109,32,102,111,117,110,100,0,87,114,111,110,103,32,109,101,100,105,117,109,32,116,121,112,101,0,78,111,32,101,114,114,111,114,32,105,110,102,111,114,109,97,116,105,111,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,10,0,17,17,17,0,0,0,0,5,0,0,0,0,0,0,9,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,15,10,17,17,17,3,10,7,0,1,19,9,11,11,0,0,9,6,11,0,0,11,0,6,17,0,0,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,17,0,10,10,17,17,17,0,10,0,0,2,0,9,11,0,0,0,9,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,13,0,0,0,4,13,0,0,0,0,9,14,0,0,0,0,0,14,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,15,0,0,0,0,9,16,0,0,0,0,0,16,0,0,16,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,18,18,18,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,9,11,0,0,0,0,0,11,0,0,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,12,0,0,0,0,9,12,0,0,0,0,0,12,0,0,12,0,0,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,45,43,32,32,32,48,88,48,120,0,40,110,117,108,108,41,0,45,48,88,43,48,88,32,48,88,45,48,120,43,48,120,32,48,120,0,105,110,102,0,73,78,70,0,110,97,110,0,78,65,78,0,46,0],"i8",4,n.Ua);var mb=n.ja(D(12,"i8",2),8);function ob(t){return e.___errno_location&&(C[e.___errno_location()>>2]=t),t}assert(0==mb%8),e._i64Subtract=nb;var J={I:1,F:2,ed:3,bc:4,H:5,Aa:6,vb:7,zc:8,ea:9,Jb:10,va:11,qd:11,Ta:12,da:13,Vb:14,Lc:15,fa:16,wa:17,rd:18,ha:19,ya:20,P:21,q:22,uc:23,Sa:24,Q:25,nd:26,Wb:27,Hc:28,ia:29,bd:30,nc:31,Vc:32,Sb:33,Zc:34,Dc:42,Zb:43,Kb:44,ec:45,fc:46,gc:47,mc:48,od:49,xc:50,dc:51,Pb:35,Ac:37,Bb:52,Eb:53,sd:54,vc:55,Fb:56,Gb:57,Qb:35,Hb:59,Jc:60,yc:61,kd:62,Ic:63,Ec:64,Fc:65,ad:66,Bc:67,yb:68,gd:69,Lb:70,Wc:71,pc:72,Tb:73,Db:74,Qc:76,Cb:77,$c:78,hc:79,ic:80,lc:81,kc:82,jc:83,Kc:38,za:39,qc:36,ga:40,Rc:95,Uc:96,Ob:104,wc:105,zb:97,Yc:91,Oc:88,Gc:92,cd:108,Nb:111,wb:98,Mb:103,tc:101,rc:100,ld:110,Xb:112,Yb:113,ac:115,Ab:114,Rb:89,oc:90,Xc:93,dd:94,xb:99,sc:102,cc:106,Mc:107,md:109,pd:87,Ub:122,hd:116,Pc:95,Cc:123,$b:84,Sc:75,Ib:125,Nc:131,Tc:130,jd:86};function pb(e,t){H.push(function(){n.L("vi",e,[t])}),pb.level=H.length}function tb(){return!!tb.p}e._memset=qb,e._bitshift64Lshr=rb,e._bitshift64Shl=sb;var ub=[],vb={};function wb(e,t){wb.p||(wb.p={}),e in wb.p||(n.L("v",t),wb.p[e]=1)}var xb={0:"Success",1:"Not super-user",2:"No such file or directory",3:"No such process",4:"Interrupted system call",5:"I/O error",6:"No such device or address",7:"Arg list too long",8:"Exec format error",9:"Bad file number",10:"No children",11:"No more processes",12:"Not enough core",13:"Permission denied",14:"Bad address",15:"Block device required",16:"Mount device busy",17:"File exists",18:"Cross-device link",19:"No such device",20:"Not a directory",21:"Is a directory",22:"Invalid argument",23:"Too many open files in system",24:"Too many open files",25:"Not a typewriter",26:"Text file busy",27:"File too large",28:"No space left on device",29:"Illegal seek",30:"Read only file system",31:"Too many links",32:"Broken pipe",33:"Math arg out of domain of func",34:"Math result not representable",35:"File locking deadlock error",36:"File or path name too long",37:"No record locks available",38:"Function not implemented",39:"Directory not empty",40:"Too many symbolic links",42:"No message of desired type",43:"Identifier removed",44:"Channel number out of range",45:"Level 2 not synchronized",46:"Level 3 halted",47:"Level 3 reset",48:"Link number out of range",49:"Protocol driver not attached",50:"No CSI structure available",51:"Level 2 halted",52:"Invalid exchange",53:"Invalid request descriptor",54:"Exchange full",55:"No anode",56:"Invalid request code",57:"Invalid slot",59:"Bad font file fmt",60:"Device not a stream",61:"No data (for no delay io)",62:"Timer expired",63:"Out of streams resources",64:"Machine is not on the network",65:"Package not installed",66:"The object is remote",67:"The link has been severed",68:"Advertise error",69:"Srmount error",70:"Communication error on send",71:"Protocol error",72:"Multihop attempted",73:"Cross mount point (not really error)",74:"Trying to read unreadable message",75:"Value too large for defined data type",76:"Given log. name not unique",77:"f.d. invalid for this operation",78:"Remote address changed",79:"Can access a needed shared lib",80:"Accessing a corrupted shared lib",81:".lib section in a.out corrupted",82:"Attempting to link in too many libs",83:"Attempting to exec a shared library",84:"Illegal byte sequence",86:"Streams pipe error",87:"Too many users",88:"Socket operation on non-socket",89:"Destination address required",90:"Message too long",91:"Protocol wrong type for socket",92:"Protocol not available",93:"Unknown protocol",94:"Socket type not supported",95:"Not supported",96:"Protocol family not supported",97:"Address family not supported by protocol family",98:"Address already in use",99:"Address not available",100:"Network interface is not configured",101:"Network is unreachable",102:"Connection reset by network",103:"Connection aborted",104:"Connection reset by peer",105:"No buffer space available",106:"Socket is already connected",107:"Socket is not connected",108:"Can't send after socket shutdown",109:"Too many references",110:"Connection timed out",111:"Connection refused",112:"Host is down",113:"Host is unreachable",114:"Socket already connected",115:"Connection already in progress",116:"Stale file handle",122:"Quota exceeded",123:"No medium (in tape drive)",125:"Operation canceled",130:"Previous owner died",131:"State not recoverable"};function yb(e,t){for(var r=0,i=e.length-1;0<=i;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function zb(e){var t="/"===e.charAt(0),r="/"===e.substr(-1);return(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Ab(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&(t=t.substr(0,t.length-1)),e+t):"."}function Bb(e){if("/"===e)return"/";var t=e.lastIndexOf("/");return-1===t?e:e.substr(t+1)}function Cb(){return zb(Array.prototype.slice.call(arguments,0).join("/"))}function K(e,t){return zb(e+"/"+t)}function Db(){for(var e="",t=!1,r=arguments.length-1;-1<=r&&!t;r--){if("string"!=typeof(t=0<=r?arguments[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";e=t+"/"+e,t="/"===t.charAt(0)}return(t?"/":"")+(e=yb(e.split("/").filter(function(e){return!!e}),!t).join("/"))||"."}var Eb=[];function Fb(e,t){Eb[e]={input:[],output:[],N:t},Gb(e,Hb)}var Hb={open:function(e){var t=Eb[e.g.rdev];if(!t)throw new L(J.ha);e.tty=t,e.seekable=!1},close:function(e){e.tty.N.flush(e.tty)},flush:function(e){e.tty.N.flush(e.tty)},read:function(e,t,r,i){if(!e.tty||!e.tty.N.La)throw new L(J.Aa);for(var n=0,o=0;oe.e.length&&(e.e=M.cb(e),e.o=e.e.length),!e.e||e.e.subarray){var r=e.e?e.e.buffer.byteLength:0;t<=r||(t=Math.max(t,r*(r<1048576?2:1.125)|0),0!=r&&(t=Math.max(t,256)),r=e.e,e.e=new Uint8Array(t),0t)e.e.length=t;else for(;e.e.length=e.g.o)return 0;if(assert(0<=(e=Math.min(e.g.o-n,i))),8>1)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return t.mode},B:function(e){for(var t=[];e.parent!==e;)t.push(e.name),e=e.parent;return t.push(e.A.pa.root),t.reverse(),Cb.apply(null,t)},Ha:{0:"r",1:"r+",2:"r+",64:"r",65:"r+",66:"r+",129:"rx+",193:"rx+",514:"w+",577:"w",578:"w+",705:"wx",706:"wx+",1024:"a",1025:"a",1026:"a+",1089:"a",1090:"a+",1153:"ax",1154:"ax+",1217:"ax",1218:"ax+",4096:"rs",4098:"rs+"},$a:function(e){if((e&=-32769)in P.Ha)return P.Ha[e];throw new L(J.q)},k:{D:function(e){var t;e=P.B(e);try{t=fs.lstatSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return P.$&&!t.K&&(t.K=4096),P.$&&!t.blocks&&(t.blocks=(t.size+t.K-1)/t.K|0),{dev:t.dev,ino:t.ino,mode:t.mode,nlink:t.nlink,uid:t.uid,gid:t.gid,rdev:t.rdev,size:t.size,atime:t.atime,mtime:t.mtime,ctime:t.ctime,K:t.K,blocks:t.blocks}},u:function(e,t){var r=P.B(e);try{void 0!==t.mode&&(fs.chmodSync(r,t.mode),e.mode=t.mode),void 0!==t.size&&fs.truncateSync(r,t.size)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},lookup:function(e,t){var r=K(P.B(e),t);r=P.Ja(r);return P.createNode(e,t,r)},T:function(e,t,r,i){e=P.createNode(e,t,r,i),t=P.B(e);try{N(e.mode)?fs.mkdirSync(t,e.mode):fs.writeFileSync(t,"",{mode:e.mode})}catch(e){if(!e.code)throw e;throw new L(J[e.code])}return e},rename:function(e,t,r){e=P.B(e),t=K(P.B(t),r);try{fs.renameSync(e,t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},unlink:function(e,t){var r=K(P.B(e),t);try{fs.unlinkSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},rmdir:function(e,t){var r=K(P.B(e),t);try{fs.rmdirSync(r)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readdir:function(e){e=P.B(e);try{return fs.readdirSync(e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},symlink:function(e,t,r){e=K(P.B(e),t);try{fs.symlinkSync(r,e)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},readlink:function(e){var t=P.B(e);try{return t=fs.readlinkSync(t),t=Ob.relative(Ob.resolve(e.A.pa.root),t)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}}},n:{open:function(e){var t=P.B(e.g);try{32768==(61440&e.g.mode)&&(e.V=fs.openSync(t,P.$a(e.flags)))}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},close:function(e){try{32768==(61440&e.g.mode)&&e.V&&fs.closeSync(e.V)}catch(e){if(!e.code)throw e;throw new L(J[e.code])}},read:function(e,t,r,i,n){if(0===i)return 0;var o,a=new Buffer(i);try{o=fs.readSync(e.V,a,0,i,n)}catch(e){throw new L(J[e.code])}if(0>>0)%Q.length}function Xb(e){var t=Wb(e.parent.id,e.name);e.M=Q[t],Q[t]=e}function Nb(e,t){var r;if(r=(r=Yb(e,"x"))?r:e.k.lookup?0:J.da)throw new L(r,e);for(r=Q[Wb(e.id,t)];r;r=r.M){var i=r.name;if(r.parent.id===e.id&&i===t)return r}return e.k.lookup(e,t)}function Lb(e,t,r,i){return Zb||((Zb=function(e,t,r,i){e||(e=this),this.parent=e,this.A=e.A,this.U=null,this.id=Sb++,this.name=t,this.mode=r,this.k={},this.n={},this.rdev=i}).prototype={},Object.defineProperties(Zb.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},kb:{get:function(){return N(this.mode)}},jb:{get:function(){return 8192==(61440&this.mode)}}})),Xb(e=new Zb(e,t,r,i)),e}function N(e){return 16384==(61440&e)}var $b={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};function Yb(e,t){return Tb?0:(-1===t.indexOf("r")||292&e.mode)&&(-1===t.indexOf("w")||146&e.mode)&&(-1===t.indexOf("x")||73&e.mode)?0:J.da}function ac(e,t){try{return Nb(e,t),J.wa}catch(e){}return Yb(e,"wx")}function bc(){for(var e=0;e<=4096;e++)if(!Rb[e])return e;throw new L(J.Sa)}function cc(e){dc||((dc=function(){}).prototype={},Object.defineProperties(dc.prototype,{object:{get:function(){return this.g},set:function(e){this.g=e}},Ld:{get:function(){return 1!=(2097155&this.flags)}},Md:{get:function(){return 0!=(2097155&this.flags)}},Kd:{get:function(){return 1024&this.flags}}}));var t,r=new dc;for(t in e)r[t]=e[t];return e=r,r=bc(),e.fd=r,Rb[r]=e}var Kb={open:function(e){e.n=Qb[e.g.rdev].n,e.n.open&&e.n.open(e)},G:function(){throw new L(J.ia)}},qc;function Gb(e,t){Qb[e]={n:t}}function ec(e,t){var r,i="/"===t,n=!t;if(i&&Pb)throw new L(J.fa);if(!i&&!n){if(t=(r=S(t,{Ia:!1})).path,(r=r.g).U)throw new L(J.fa);if(!N(r.mode))throw new L(J.ya)}n={type:e,pa:{},Oa:t,lb:[]};var o=e.A(n);(o.A=n).root=o,i?Pb=o:r&&(r.U=n,r.A&&r.A.lb.push(n))}function fc(e,t,r){var i=S(e,{parent:!0}).g;if(!(e=Bb(e))||"."===e||".."===e)throw new L(J.q);var n=ac(i,e);if(n)throw new L(n);if(!i.k.T)throw new L(J.I);return i.k.T(i,e,t,r)}function gc(e,t){return t=4095&(void 0!==t?t:438),fc(e,t|=32768,0)}function V(e,t){return t=1023&(void 0!==t?t:511),fc(e,t|=16384,0)}function hc(e,t,r){return void 0===r&&(r=t,t=438),fc(e,8192|t,r)}function ic(e,t){if(!Db(e))throw new L(J.F);var r=S(t,{parent:!0}).g;if(!r)throw new L(J.F);var i=Bb(t),n=ac(r,i);if(n)throw new L(n);if(!r.k.symlink)throw new L(J.I);return r.k.symlink(r,i,e)}function Vb(e){if(!(e=S(e).g))throw new L(J.F);if(!e.k.readlink)throw new L(J.q);return Db(T(e.parent),e.k.readlink(e))}function jc(e,t){var r;if(!(r="string"==typeof e?S(e,{la:!0}).g:e).k.u)throw new L(J.I);r.k.u(r,{mode:4095&t|-4096&r.mode,timestamp:Date.now()})}function kc(t,r){var i,n,o;if(""===t)throw new L(J.F);if("string"==typeof r){if(void 0===(n=$b[r]))throw Error("Unknown file open mode: "+r)}else n=r;if(i=64&(r=n)?4095&(void 0===i?438:i)|32768:0,"object"==typeof t)o=t;else{t=zb(t);try{o=S(t,{la:!(131072&r)}).g}catch(e){}}if(n=!1,64&r)if(o){if(128&r)throw new L(J.wa)}else o=fc(t,i,0),n=!0;if(!o)throw new L(J.F);if(8192==(61440&o.mode)&&(r&=-513),65536&r&&!N(o.mode))throw new L(J.ya);if(!n&&(i=o?40960==(61440&o.mode)?J.ga:N(o.mode)&&(0!=(2097155&r)||512&r)?J.P:(i=["r","w","rw"][3&r],512&r&&(i+="w"),Yb(o,i)):J.F))throw new L(i);if(512&r){var a;if(!(a="string"==typeof(i=o)?S(i,{la:!0}).g:i).k.u)throw new L(J.I);if(N(a.mode))throw new L(J.P);if(32768!=(61440&a.mode))throw new L(J.q);if(i=Yb(a,"w"))throw new L(i);a.k.u(a,{size:0,timestamp:Date.now()})}r&=-641,(o=cc({g:o,path:T(o),flags:r,seekable:!0,position:0,n:o.n,tb:[],error:!1})).n.open&&o.n.open(o),!e.logReadFiles||1&r||(lc||(lc={}),t in lc||(lc[t]=1,e.printErr("read file: "+t)));try{R.onOpenFile&&(a=0,1!=(2097155&r)&&(a|=1),0!=(2097155&r)&&(a|=2),R.onOpenFile(t,a))}catch(e){console.log("FS.trackingDelegate['onOpenFile']('"+t+"', flags) threw an exception: "+e.message)}return o}function mc(e){e.na&&(e.na=null);try{e.n.close&&e.n.close(e)}catch(e){throw e}finally{Rb[e.fd]=null}}function nc(e,t,r){if(!e.seekable||!e.n.G)throw new L(J.ia);e.position=e.n.G(e,t,r),e.tb=[]}function oc(e,t,r,i,n,o){if(i<0||n<0)throw new L(J.q);if(0==(2097155&e.flags))throw new L(J.ea);if(N(e.g.mode))throw new L(J.P);if(!e.n.write)throw new L(J.q);1024&e.flags&&nc(e,0,2);var a=!0;if(void 0===n)n=e.position,a=!1;else if(!e.seekable)throw new L(J.ia);t=e.n.write(e,t,r,i,n,o),a||(e.position+=t);try{e.path&&R.onWriteToFile&&R.onWriteToFile(e.path)}catch(e){console.log("FS.trackingDelegate['onWriteToFile']('"+path+"') threw an exception: "+e.message)}return t}function pc(){L||((L=function(e,t){this.g=t,this.qb=function(e){for(var t in this.S=e,J)if(J[t]===e){this.code=t;break}},this.qb(e),this.message=xb[e]}).prototype=Error(),L.prototype.constructor=L,[J.F].forEach(function(e){Mb[e]=new L(e),Mb[e].stack=""}))}function rc(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r}function sc(e,t,r,i){return gc(e=K("string"==typeof e?e:T(e),t),rc(r,i))}function tc(e,t,r,i,n,o){if(n=gc(e=t?K("string"==typeof e?e:T(e),t):e,i=rc(i,n)),r){if("string"==typeof r){e=Array(r.length),t=0;for(var a=r.length;t>2]}function xc(){var e;if(e=X(),!(e=Rb[e]))throw new L(J.ea);return e}var yc={};function Ga(e){Ga.p||(r=Qa(r),Ga.p=!0,assert(n.R),Ga.bb=n.R,n.R=function(){x("cannot dynamically allocate, sbrk now has control")});var t=r;return 0==e||Ga.bb(e)?t:4294967295}e._i64Add=zc;var Ac=1;function Cc(e,t){if(Dc=e,Ec=t,!Fc)return 1;if(0==e)Y=function(){setTimeout(Gc,t)},Hc="timeout";else if(1==e)Y=function(){Ic(Gc)},Hc="rAF";else if(2==e){if(!window.setImmediate){var r=[];window.addEventListener("message",function(e){e.source===window&&"__emcc"===e.data&&(e.stopPropagation(),r.shift()())},!0),window.setImmediate=function(e){r.push(e),window.postMessage("__emcc","*")}}Y=function(){window.setImmediate(Gc)},Hc="immediate"}return 0}function Jc(a,t,r,s,i){e.noExitRuntime=!0,assert(!Fc,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),Fc=a,Kc=s;var l=Lc;if(Gc=function(){if(!na)if(0>r-6&63;r=r-6,e=e+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[n]}2==r?(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(3&t)<<4],e+="=="):4==r&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(15&t)<<2],e+="="),u.src="data:audio/x-"+a.substr(-3)+";base64,"+e,s(u)}},u.src=n,ad(function(){s(u)})}});var r=e.canvas;r&&(r.sa=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||function(){},r.Fa=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||function(){},r.Fa=r.Fa.bind(document),document.addEventListener("pointerlockchange",t,!1),document.addEventListener("mozpointerlockchange",t,!1),document.addEventListener("webkitpointerlockchange",t,!1),document.addEventListener("mspointerlockchange",t,!1),e.elementPointerLock&&r.addEventListener("click",function(e){!Tc&&r.sa&&(r.sa(),e.preventDefault())},!1))}}function bd(t,r,i,n){if(r&&e.ka&&t==e.canvas)return e.ka;var o,a;if(r){if(a={antialias:!1,alpha:!1},n)for(var s in n)a[s]=n[s];(a=GL.createContext(t,a))&&(o=GL.getContext(a).td),t.style.backgroundColor="black"}else o=t.getContext("2d");return o?(i&&(r||assert("undefined"==typeof GLctx,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),e.ka=o,r&&GL.Od(a),e.Td=r,Uc.forEach(function(e){e()}),Vc()),o):null}var cd=!1,dd=void 0,ed=void 0;function fd(t,r,i){function n(){Sc=!1;var t=o.parentNode;(document.webkitFullScreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.mozFullscreenElement||document.fullScreenElement||document.fullscreenElement||document.msFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement)===t?(o.Da=document.cancelFullScreen||document.mozCancelFullScreen||document.webkitCancelFullScreen||document.msExitFullscreen||document.exitFullscreen||function(){},o.Da=o.Da.bind(document),dd&&o.sa(),Sc=!0,ed&&gd()):(t.parentNode.insertBefore(o,t),t.parentNode.removeChild(t),ed&&hd()),e.onFullScreen&&e.onFullScreen(Sc),id(o)}void 0===(dd=t)&&(dd=!0),void 0===(ed=r)&&(ed=!1),void 0===(jd=i)&&(jd=null);var o=e.canvas;cd||(cd=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o),a.p=a.requestFullScreen||a.mozRequestFullScreen||a.msRequestFullscreen||(a.webkitRequestFullScreen?function(){a.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}:null),i?a.p({Ud:i}):a.p()}var kd=0;function ld(e){var t=Date.now();if(0===kd)kd=t+1e3/60;else for(;kd<=t+2;)kd+=1e3/60;t=Math.max(kd-t,0),setTimeout(e,t)}function Ic(e){"undefined"==typeof window?ld(e):(window.requestAnimationFrame||(window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||ld),window.requestAnimationFrame(e))}function ad(t){e.noExitRuntime=!0,setTimeout(function(){na||t()},1e4)}function $c(e){return{jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]}function md(e,t,r){var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)}function nd(t,r,e){md(t,function(e){assert(e,'Loading data file "'+t+'" failed (no arrayBuffer).'),r(new Uint8Array(e)),lb()},function(){if(!e)throw'Loading data file "'+t+'" failed.';e()}),kb()}var od=[],Wc,Xc,Yc,Zc,jd;function pd(){var t=e.canvas;od.forEach(function(e){e(t.width,t.height)})}function gd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=8388608|e}pd()}function hd(){if("undefined"!=typeof SDL){var e=Sa[SDL.screen+0*n.J>>2];C[SDL.screen+0*n.J>>2]=-8388609&e}pd()}function id(t,r,i){r&&i?(t.ub=r,t.hb=i):(r=t.ub,i=t.hb);var n=r,o=i;if(e.forcedAspectRatio&&0this.length-1||e<0)){var t=e%this.chunkSize;return this.gb(e/this.chunkSize|0)[t]}},a.prototype.pb=function(e){this.gb=e},a.prototype.Ca=function(){var e=new XMLHttpRequest;if(e.open("HEAD",l,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw Error("Couldn't load "+l+". Status: "+e.status);var t,o=Number(e.getResponseHeader("Content-length")),a=1048576;(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t||(a=o);var s=this;s.pb(function(e){var t=e*a,r=(e+1)*a-1;r=Math.min(r,o-1);if(void 0===s.Y[e]){var i=s.Y;if(r=(e=e.g.e).length)return 0;if(assert(0<=(i=Math.min(e.length-n,i))),e.slice)for(var o=0;o>2]=0;case 21520:return r.tty?-J.q:-J.Q;case 21531:if(n=X(),!r.n.ib)throw new L(J.Q);return r.n.ib(r,i,n);default:x("bad ioctl syscall "+i)}}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall6:function(e,t){wc=t;try{return mc(xc()),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},_emscripten_set_main_loop_timing:Cc,__ZSt18uncaught_exceptionv:tb,___setErrNo:ob,_sbrk:Ga,___cxa_begin_catch:function(e){var t;tb.p--,ub.push(e);e:{if(e&&!vb[e])for(t in vb)if(vb[t].wd===e)break e;t=e}return t&&vb[t].Sd++,e},_emscripten_memcpy_big:function(e,t,r){return E.set(E.subarray(t,t+r),e),e},_sysconf:function(e){switch(e){case 30:return 4096;case 85:return F/4096;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator&&navigator.hardwareConcurrency||1}return ob(J.q),-1},_pthread_getspecific:function(e){return yc[e]||0},_pthread_self:function(){return 0},_pthread_once:wb,_pthread_key_create:function(e){return 0==e?J.q:(C[e>>2]=Ac,yc[Ac]=0,Ac++,0)},___unlock:function(){},_emscripten_set_main_loop:Jc,_pthread_setspecific:function(e,t){return e in yc?(yc[e]=t,0):J.q},___lock:function(){},_abort:function(){e.abort()},_pthread_cleanup_push:pb,_time:function(e){var t=Date.now()/1e3|0;return e&&(C[e>>2]=t),t},___syscall140:function(e,t){wc=t;try{var r=xc(),i=X(),n=X(),o=X(),a=X();return assert(0===i),nc(r,n,a),C[o>>2]=r.position,r.na&&0===n&&0===a&&(r.na=null),0}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},___syscall146:function(e,t){wc=t;try{var r,i=xc(),n=X();e:{for(var o=X(),a=0,s=0;s>2],C[n+(8*s+4)>>2],void 0);if(l<0){r=-1;break e}a+=l}r=a}return r}catch(e){return void 0!==vc&&e instanceof L||x(e),-e.S}},STACKTOP:m,STACK_MAX:Va,tempDoublePtr:mb,ABORT:na,cttz_i8:qd};var Z=function(e,t,r){"use asm";var i=e.Int8Array;var n=e.Int16Array;var o=e.Int32Array;var a=e.Uint8Array;var s=e.Uint16Array;var l=e.Uint32Array;var u=e.Float32Array;var h=e.Float64Array;var pe=new i(r);var $=new n(r);var de=new o(r);var me=new a(r);var ge=new s(r);var c=new l(r);var f=new u(r);var ee=new h(r);var p=e.byteLength;var ve=t.STACKTOP|0;var d=t.STACK_MAX|0;var te=t.tempDoublePtr|0;var m=t.ABORT|0;var g=t.cttz_i8|0;var v=0;var _=0;var y=0;var b=0;var x=e.NaN,w=e.Infinity;var T=0,k=0,P=0,S=0,E=0.0,A=0,C=0,I=0,O=0.0;var re=0;var M=0;var D=0;var R=0;var z=0;var L=0;var F=0;var j=0;var N=0;var B=0;var U=e.Math.floor;var X=e.Math.abs;var H=e.Math.sqrt;var G=e.Math.pow;var W=e.Math.cos;var q=e.Math.sin;var V=e.Math.tan;var Y=e.Math.acos;var Z=e.Math.asin;var J=e.Math.atan;var K=e.Math.atan2;var Q=e.Math.exp;var ie=e.Math.log;var ne=e.Math.ceil;var _e=e.Math.imul;var oe=e.Math.min;var ae=e.Math.clz32;var se=t.abort;var le=t.assert;var ue=t.invoke_iiii;var he=t.invoke_viiiii;var ce=t.invoke_vi;var fe=t.invoke_ii;var ye=t.invoke_viii;var be=t.invoke_v;var xe=t.invoke_viiiiii;var we=t.invoke_iiiiii;var Te=t.invoke_viiii;var ke=t._pthread_cleanup_pop;var Pe=t.___syscall54;var Se=t.___syscall6;var Ee=t._emscripten_set_main_loop_timing;var Ae=t.__ZSt18uncaught_exceptionv;var Ce=t.___setErrNo;var Ie=t._sbrk;var Oe=t.___cxa_begin_catch;var Me=t._emscripten_memcpy_big;var De=t._sysconf;var Re=t._pthread_getspecific;var ze=t._pthread_self;var Le=t._pthread_once;var Fe=t._pthread_key_create;var je=t.___unlock;var Ne=t._emscripten_set_main_loop;var Be=t._pthread_setspecific;var Ue=t.___lock;var Xe=t._abort;var He=t._pthread_cleanup_push;var Ge=t._time;var We=t.___syscall140;var qe=t.___syscall146;var Ve=0.0;function Ye(e){if(p(e)&16777215||p(e)<=16777215||p(e)>2147483648)return false;pe=new i(e);$=new n(e);de=new o(e);me=new a(e);ge=new s(e);c=new l(e);f=new u(e);ee=new h(e);r=e;return true}function Ze(e){e=e|0;var t=0;t=ve;ve=ve+e|0;ve=ve+15&-16;return t|0}function Je(){return ve|0}function Ke(e){e=e|0;ve=e}function Qe(e,t){e=e|0;t=t|0;ve=e;d=t}function $e(e,t){e=e|0;t=t|0;if(!v){v=e;_=t}}function et(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0]}function tt(e){e=e|0;pe[te>>0]=pe[e>>0];pe[te+1>>0]=pe[e+1>>0];pe[te+2>>0]=pe[e+2>>0];pe[te+3>>0]=pe[e+3>>0];pe[te+4>>0]=pe[e+4>>0];pe[te+5>>0]=pe[e+5>>0];pe[te+6>>0]=pe[e+6>>0];pe[te+7>>0]=pe[e+7>>0]}function rt(e){e=e|0;re=e}function it(){return re|0}function nt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ve;ve=ve+608|0;f=m+88|0;c=m+72|0;l=m+64|0;s=m+48|0;a=m+24|0;o=m;h=m+96|0;p=m+92|0;u=e+4|0;d=e+8|0;if((de[u>>2]|0)>>>0>(de[d>>2]|0)>>>0){de[o>>2]=1154;de[o+4>>2]=2120;de[o+8>>2]=1133;br(h,1100,o)|0;yr(h,m+16|0)|0}if((2147418112/(i>>>0)|0)>>>0<=t>>>0){de[a>>2]=1154;de[a+4>>2]=2121;de[a+8>>2]=1169;br(h,1100,a)|0;yr(h,m+40|0)|0}a=de[d>>2]|0;if(a>>>0>=t>>>0){d=1;ve=m;return d|0}do{if(r){if(t){o=t+-1|0;if(!(o&t)){o=11;break}else t=o}else t=-1;t=t>>>16|t;t=t>>>8|t;t=t>>>4|t;t=t>>>2|t;t=(t>>>1|t)+1|0;o=10}else o=10}while(0);if((o|0)==10)if(!t){t=0;o=12}else o=11;if((o|0)==11)if(t>>>0<=a>>>0)o=12;if((o|0)==12){de[s>>2]=1154;de[s+4>>2]=2130;de[s+8>>2]=1217;br(h,1100,s)|0;yr(h,l)|0}r=_e(t,i)|0;do{if(!n){o=ot(de[e>>2]|0,r,p,1)|0;if(!o){d=0;ve=m;return d|0}else{de[e>>2]=o;break}}else{a=at(r,p)|0;if(!a){d=0;ve=m;return d|0}Ii[n&0](a,de[e>>2]|0,de[u>>2]|0);o=de[e>>2]|0;do{if(o)if(!(o&7)){Di[de[104>>2]&1](o,0,0,1,de[27]|0)|0;break}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;break}}while(0);de[e>>2]=a}}while(0);o=de[p>>2]|0;if(o>>>0>r>>>0)t=(o>>>0)/(i>>>0)|0;de[d>>2]=t;d=1;ve=m;return d|0}function ot(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=ve;ve=ve+592|0;l=u+48|0;o=u+24|0;n=u;s=u+72|0;a=u+68|0;if(e&7){de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1494;br(s,1100,n)|0;yr(s,u+16|0)|0;l=0;ve=u;return l|0}if(t>>>0>2147418112){de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1387;br(s,1100,o)|0;yr(s,u+40|0)|0;l=0;ve=u;return l|0}de[a>>2]=t;i=Di[de[104>>2]&1](e,t,a,i,de[27]|0)|0;if(r)de[r>>2]=de[a>>2];if(!(i&7)){l=i;ve=u;return l|0}de[l>>2]=1154;de[l+4>>2]=2551;de[l+8>>2]=1440;br(s,1100,l)|0;yr(s,u+64|0)|0;l=i;ve=u;return l|0}function at(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+592|0;a=l+48|0;s=l+24|0;r=l;o=l+72|0;n=l+68|0;i=e+3&-4;i=(i|0)!=0?i:4;if(i>>>0>2147418112){de[r>>2]=1154;de[r+4>>2]=2499;de[r+8>>2]=1387;br(o,1100,r)|0;yr(o,l+16|0)|0;s=0;ve=l;return s|0}de[n>>2]=i;r=Di[de[104>>2]&1](0,i,n,1,de[27]|0)|0;e=de[n>>2]|0;if(t)de[t>>2]=e;if((r|0)==0|e>>>0>>0){de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1413;br(o,1100,s)|0;yr(o,l+40|0)|0;s=0;ve=l;return s|0}if(!(r&7)){s=r;ve=l;return s|0}de[a>>2]=1154;de[a+4>>2]=2526;de[a+8>>2]=1440;br(o,1100,a)|0;yr(o,l+64|0)|0;s=r;ve=l;return s|0}function st(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0;j=ve;ve=ve+960|0;z=j+232|0;R=j+216|0;D=j+208|0;M=j+192|0;O=j+184|0;I=j+168|0;C=j+160|0;A=j+144|0;P=j+136|0;k=j+120|0;T=j+112|0;w=j+96|0;y=j+88|0;_=j+72|0;v=j+64|0;g=j+48|0;c=j+40|0;p=j+24|0;f=j+16|0;h=j;E=j+440|0;L=j+376|0;F=j+304|0;m=j+236|0;if((t|0)==0|i>>>0>11){e=0;ve=j;return e|0}de[e>>2]=t;n=F;o=n+68|0;do{de[n>>2]=0;n=n+4|0}while((n|0)<(o|0));o=0;do{n=pe[r+o>>0]|0;if(n<<24>>24){S=F+((n&255)<<2)|0;de[S>>2]=(de[S>>2]|0)+1}o=o+1|0}while((o|0)!=(t|0));o=0;u=1;a=0;s=-1;l=0;while(1){n=de[F+(u<<2)>>2]|0;if(!n)de[e+28+(u+-1<<2)>>2]=0;else{S=u+-1|0;de[L+(S<<2)>>2]=o;o=n+o|0;x=16-u|0;de[e+28+(S<<2)>>2]=(o+-1<>2]=l;de[m+(u<<2)>>2]=l;a=a>>>0>u>>>0?a:u;s=s>>>0>>0?s:u;l=n+l|0}u=u+1|0;if((u|0)==17){S=a;break}else o=o<<1}de[e+4>>2]=l;o=e+172|0;do{if(l>>>0>(de[o>>2]|0)>>>0){de[o>>2]=l;if(l){n=l+-1|0;if(n&l)d=14}else{n=-1;d=14}if((d|0)==14){x=n>>>16|n;x=x>>>8|x;x=x>>>4|x;x=x>>>2|x;x=(x>>>1|x)+1|0;de[o>>2]=x>>>0>t>>>0?t:x}a=e+176|0;n=de[a>>2]|0;do{if(n){x=de[n+-4>>2]|0;n=n+-8|0;if(!((x|0)!=0?(x|0)==(~de[n>>2]|0):0)){de[h>>2]=1154;de[h+4>>2]=644;de[h+8>>2]=1863;br(E,1100,h)|0;yr(E,f)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(E,1100,p)|0;yr(E,c)|0;break}}}while(0);o=de[o>>2]|0;o=(o|0)!=0?o:1;n=at((o<<1)+8|0,0)|0;if(!n){de[a>>2]=0;n=0;break}else{de[n+4>>2]=o;de[n>>2]=~o;de[a>>2]=n+8;d=25;break}}else d=25}while(0);e:do{if((d|0)==25){x=e+24|0;pe[x>>0]=s;pe[e+25>>0]=S;o=e+176|0;a=0;do{b=pe[r+a>>0]|0;n=b&255;if(b<<24>>24){if(!(de[F+(n<<2)>>2]|0)){de[g>>2]=1154;de[g+4>>2]=2273;de[g+8>>2]=1261;br(E,1100,g)|0;yr(E,v)|0}b=m+(n<<2)|0;n=de[b>>2]|0;de[b>>2]=n+1;if(n>>>0>=l>>>0){de[_>>2]=1154;de[_+4>>2]=2277;de[_+8>>2]=1274;br(E,1100,_)|0;yr(E,y)|0}$[(de[o>>2]|0)+(n<<1)>>1]=a}a=a+1|0}while((a|0)!=(t|0));n=pe[x>>0]|0;y=(n&255)>>>0>>0?i:0;b=e+8|0;de[b>>2]=y;_=(y|0)!=0;if(_){v=1<>>0>(de[n>>2]|0)>>>0){de[n>>2]=v;a=e+168|0;n=de[a>>2]|0;do{if(n){g=de[n+-4>>2]|0;n=n+-8|0;if(!((g|0)!=0?(g|0)==(~de[n>>2]|0):0)){de[w>>2]=1154;de[w+4>>2]=644;de[w+8>>2]=1863;br(E,1100,w)|0;yr(E,T)|0}if(!(n&7)){Di[de[104>>2]&1](n,0,0,1,de[27]|0)|0;break}else{de[k>>2]=1154;de[k+4>>2]=2499;de[k+8>>2]=1516;br(E,1100,k)|0;yr(E,P)|0;break}}}while(0);n=v<<2;o=at(n+8|0,0)|0;if(!o){de[a>>2]=0;n=0;break e}else{P=o+8|0;de[o+4>>2]=v;de[o>>2]=~v;de[a>>2]=P;o=P;break}}else{o=e+168|0;n=v<<2;a=o;o=de[o>>2]|0}}while(0);Yr(o|0,-1,n|0)|0;d=e+176|0;g=1;do{if(de[F+(g<<2)>>2]|0){t=y-g|0;m=1<>2]|0;if(o>>>0>=16){de[A>>2]=1154;de[A+4>>2]=1953;de[A+8>>2]=1737;br(E,1100,A)|0;yr(E,C)|0}n=de[e+28+(o<<2)>>2]|0;if(!n)p=-1;else p=(n+-1|0)>>>(16-g|0);if(s>>>0<=p>>>0){c=(de[e+96+(o<<2)>>2]|0)-s|0;f=g<<16;do{n=ge[(de[d>>2]|0)+(c+s<<1)>>1]|0;if((me[r+n>>0]|0|0)!=(g|0)){de[I>>2]=1154;de[I+4>>2]=2319;de[I+8>>2]=1303;br(E,1100,I)|0;yr(E,O)|0}h=s<>>0>=v>>>0){de[M>>2]=1154;de[M+4>>2]=2325;de[M+8>>2]=1337;br(E,1100,M)|0;yr(E,D)|0}n=de[a>>2]|0;if((de[n+(l<<2)>>2]|0)!=-1){de[R>>2]=1154;de[R+4>>2]=2327;de[R+8>>2]=1360;br(E,1100,R)|0;yr(E,z)|0;n=de[a>>2]|0}de[n+(l<<2)>>2]=o;u=u+1|0}while(u>>>0>>0);s=s+1|0}while(s>>>0<=p>>>0)}}g=g+1|0}while(y>>>0>=g>>>0);n=pe[x>>0]|0}o=e+96|0;de[o>>2]=(de[o>>2]|0)-(de[L>>2]|0);o=e+100|0;de[o>>2]=(de[o>>2]|0)-(de[L+4>>2]|0);o=e+104|0;de[o>>2]=(de[o>>2]|0)-(de[L+8>>2]|0);o=e+108|0;de[o>>2]=(de[o>>2]|0)-(de[L+12>>2]|0);o=e+112|0;de[o>>2]=(de[o>>2]|0)-(de[L+16>>2]|0);o=e+116|0;de[o>>2]=(de[o>>2]|0)-(de[L+20>>2]|0);o=e+120|0;de[o>>2]=(de[o>>2]|0)-(de[L+24>>2]|0);o=e+124|0;de[o>>2]=(de[o>>2]|0)-(de[L+28>>2]|0);o=e+128|0;de[o>>2]=(de[o>>2]|0)-(de[L+32>>2]|0);o=e+132|0;de[o>>2]=(de[o>>2]|0)-(de[L+36>>2]|0);o=e+136|0;de[o>>2]=(de[o>>2]|0)-(de[L+40>>2]|0);o=e+140|0;de[o>>2]=(de[o>>2]|0)-(de[L+44>>2]|0);o=e+144|0;de[o>>2]=(de[o>>2]|0)-(de[L+48>>2]|0);o=e+148|0;de[o>>2]=(de[o>>2]|0)-(de[L+52>>2]|0);o=e+152|0;de[o>>2]=(de[o>>2]|0)-(de[L+56>>2]|0);o=e+156|0;de[o>>2]=(de[o>>2]|0)-(de[L+60>>2]|0);o=e+16|0;de[o>>2]=0;a=e+20|0;de[a>>2]=n&255;t:do{if(_){while(1){if(!i)break t;n=i+-1|0;if(!(de[F+(i<<2)>>2]|0))i=n;else break}de[o>>2]=de[e+28+(n<<2)>>2];n=y+1|0;de[a>>2]=n;if(n>>>0<=S>>>0){while(1){if(de[F+(n<<2)>>2]|0)break;n=n+1|0;if(n>>>0>S>>>0)break t}de[a>>2]=n}}}while(0);de[e+92>>2]=-1;de[e+160>>2]=1048575;de[e+12>>2]=32-(de[b>>2]|0);n=1}}while(0);e=n;ve=j;return e|0}function lt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0;if(!e){n=Br(t)|0;if(!r){r=n;return r|0}if(!n)o=0;else o=Hr(n)|0;de[r>>2]=o;r=n;return r|0}if(!t){Ur(e);if(!r){r=0;return r|0}de[r>>2]=0;r=0;return r|0}n=Xr(e,t)|0;o=(n|0)!=0;if(o|i^1)o=o?n:e;else{n=Xr(e,t)|0;o=(n|0)==0?e:n}if(!r){r=n;return r|0}t=Hr(o)|0;de[r>>2]=t;r=n;return r|0}function ut(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(!((e|0)!=0&t>>>0>73&(r|0)!=0)){r=0;return r|0}if((de[r>>2]|0)!=40|t>>>0<74){r=0;return r|0}if(((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)!=18552){r=0;return r|0}if(((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0<74){r=0;return r|0}if(((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0>t>>>0){r=0;return r|0}de[r+4>>2]=(me[e+12>>0]|0)<<8|(me[e+13>>0]|0);de[r+8>>2]=(me[e+14>>0]|0)<<8|(me[e+15>>0]|0);de[r+12>>2]=me[e+16>>0];de[r+16>>2]=me[e+17>>0];t=e+18|0;i=r+32|0;de[i>>2]=me[t>>0];de[i+4>>2]=0;t=pe[t>>0]|0;de[r+20>>2]=t<<24>>24==0|t<<24>>24==9?8:16;de[r+24>>2]=(me[e+26>>0]|0)<<16|(me[e+25>>0]|0)<<24|(me[e+27>>0]|0)<<8|(me[e+28>>0]|0);de[r+28>>2]=(me[e+30>>0]|0)<<16|(me[e+29>>0]|0)<<24|(me[e+31>>0]|0)<<8|(me[e+32>>0]|0);r=1;return r|0}function ht(e){e=e|0;Oe(e|0)|0;Ut()}function ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0;o=ve;ve=ve+544|0;n=o;i=o+24|0;t=de[e+20>>2]|0;if(t)ft(t);t=e+4|0;r=de[t>>2]|0;if(!r){n=e+16|0;pe[n>>0]=0;ve=o;return}if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;br(i,1100,n)|0;yr(i,o+16|0)|0}de[t>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;n=e+16|0;pe[n>>0]=0;ve=o;return}function ft(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=ve;ve=ve+640|0;f=p+112|0;c=p+96|0;h=p+88|0;u=p+72|0;l=p+64|0;s=p+48|0;i=p+40|0;o=p+24|0;n=p+16|0;r=p;a=p+120|0;if(!e){ve=p;return}t=de[e+168>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[r>>2]=1154;de[r+4>>2]=644;de[r+8>>2]=1863;br(a,1100,r)|0;yr(a,n)|0}if(!(t&7)){Di[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[o>>2]=1154;de[o+4>>2]=2499;de[o+8>>2]=1516;br(a,1100,o)|0;yr(a,i)|0;break}}}while(0);t=de[e+176>>2]|0;do{if(t){d=de[t+-4>>2]|0;t=t+-8|0;if(!((d|0)!=0?(d|0)==(~de[t>>2]|0):0)){de[s>>2]=1154;de[s+4>>2]=644;de[s+8>>2]=1863;br(a,1100,s)|0;yr(a,l)|0}if(!(t&7)){Di[de[104>>2]&1](t,0,0,1,de[27]|0)|0;break}else{de[u>>2]=1154;de[u+4>>2]=2499;de[u+8>>2]=1516;br(a,1100,u)|0;yr(a,h)|0;break}}}while(0);if(!(e&7)){Di[de[104>>2]&1](e,0,0,1,de[27]|0)|0;ve=p;return}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(a,1100,c)|0;yr(a,f)|0;ve=p;return}}function pt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+560|0;a=h+40|0;s=h+24|0;t=h;o=h+48|0;n=e+8|0;r=de[n>>2]|0;if((r+-1|0)>>>0>=8192){de[t>>2]=1154;de[t+4>>2]=2997;de[t+8>>2]=1541;br(o,1100,t)|0;yr(o,h+16|0)|0}de[e>>2]=r;i=e+20|0;t=de[i>>2]|0;if(!t){t=at(180,0)|0;if(!t)t=0;else{u=t+164|0;de[u>>2]=0;de[u+4>>2]=0;de[u+8>>2]=0;de[u+12>>2]=0}de[i>>2]=t;u=t;l=de[e>>2]|0}else{u=t;l=r}if(!(de[n>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(o,1100,s)|0;yr(o,a)|0;o=de[e>>2]|0}else o=l;n=de[e+4>>2]|0;if(o>>>0>16){r=o;t=0}else{e=0;u=st(u,l,n,e)|0;ve=h;return u|0}while(1){i=t+1|0;if(r>>>0>3){r=r>>>1;t=i}else{r=i;break}}e=t+2+((r|0)!=32&1<>>0>>0&1)|0;e=e>>>0<11?e&255:11;u=st(u,l,n,e)|0;ve=h;return u|0}function dt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0;z=ve;ve=ve+800|0;I=z+256|0;C=z+240|0;A=z+232|0;E=z+216|0;S=z+208|0;P=z+192|0;k=z+184|0;T=z+168|0;w=z+160|0;x=z+144|0;b=z+136|0;y=z+120|0;_=z+112|0;v=z+96|0;g=z+88|0;m=z+72|0;c=z+64|0;h=z+48|0;s=z+40|0;l=z+24|0;o=z+16|0;n=z;D=z+288|0;R=z+264|0;O=mt(e,14)|0;if(!O){de[t>>2]=0;r=t+4|0;i=de[r>>2]|0;if(i){if(!(i&7))Di[de[104>>2]&1](i,0,0,1,de[27]|0)|0;else{de[n>>2]=1154;de[n+4>>2]=2499;de[n+8>>2]=1516;br(D,1100,n)|0;yr(D,o)|0}de[r>>2]=0;de[t+8>>2]=0;de[t+12>>2]=0}pe[t+16>>0]=0;r=t+20|0;i=de[r>>2]|0;if(!i){t=1;ve=z;return t|0}ft(i);de[r>>2]=0;t=1;ve=z;return t|0}p=t+4|0;d=t+8|0;r=de[d>>2]|0;if((r|0)!=(O|0)){if(r>>>0<=O>>>0){do{if((de[t+12>>2]|0)>>>0>>0){if(nt(p,O,(r+1|0)==(O|0),1,0)|0){r=de[d>>2]|0;break}pe[t+16>>0]=1;t=0;ve=z;return t|0}}while(0);Yr((de[p>>2]|0)+r|0,0,O-r|0)|0}de[d>>2]=O}Yr(de[p>>2]|0,0,O|0)|0;f=e+20|0;r=de[f>>2]|0;if((r|0)<5){o=e+4|0;a=e+8|0;n=e+16|0;do{i=de[o>>2]|0;if((i|0)==(de[a>>2]|0))i=0;else{de[o>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;br(D,1100,l)|0;yr(D,s)|0;r=de[f>>2]|0}i=i<<32-r|de[n>>2];de[n>>2]=i}while((r|0)<5)}else{i=e+16|0;n=i;i=de[i>>2]|0}u=i>>>27;de[n>>2]=i<<5;de[f>>2]=r+-5;if((u+-1|0)>>>0>20){t=0;ve=z;return t|0}de[R+20>>2]=0;de[R>>2]=0;de[R+4>>2]=0;de[R+8>>2]=0;de[R+12>>2]=0;pe[R+16>>0]=0;r=R+4|0;i=R+8|0;e:do{if(nt(r,21,0,1,0)|0){s=de[i>>2]|0;l=de[r>>2]|0;Yr(l+s|0,0,21-s|0)|0;de[i>>2]=21;if(u){n=e+4|0;o=e+8|0;a=e+16|0;s=0;do{r=de[f>>2]|0;if((r|0)<3)do{i=de[n>>2]|0;if((i|0)==(de[o>>2]|0))i=0;else{de[n>>2]=i+1;i=me[i>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[h>>2]=1154;de[h+4>>2]=3199;de[h+8>>2]=1650;br(D,1100,h)|0;yr(D,c)|0;r=de[f>>2]|0}i=i<<32-r|de[a>>2];de[a>>2]=i}while((r|0)<3);else i=de[a>>2]|0;de[a>>2]=i<<3;de[f>>2]=r+-3;pe[l+(me[1611+s>>0]|0)>>0]=i>>>29;s=s+1|0}while((s|0)!=(u|0))}if(pt(R)|0){s=e+4|0;l=e+8|0;u=e+16|0;i=0;t:while(1){a=O-i|0;r=gt(e,R)|0;r:do{if(r>>>0<17){if((de[d>>2]|0)>>>0<=i>>>0){de[m>>2]=1154;de[m+4>>2]=903;de[m+8>>2]=1781;br(D,1100,m)|0;yr(D,g)|0}pe[(de[p>>2]|0)+i>>0]=r;r=i+1|0}else switch(r|0){case 17:{r=de[f>>2]|0;if((r|0)<3)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[v>>2]=1154;de[v+4>>2]=3199;de[v+8>>2]=1650;br(D,1100,v)|0;yr(D,_)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<3);else n=de[u>>2]|0;de[u>>2]=n<<3;de[f>>2]=r+-3;r=(n>>>29)+3|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}case 18:{r=de[f>>2]|0;if((r|0)<7)do{n=de[s>>2]|0;if((n|0)==(de[l>>2]|0))n=0;else{de[s>>2]=n+1;n=me[n>>0]|0}r=r+8|0;de[f>>2]=r;if((r|0)>=33){de[y>>2]=1154;de[y+4>>2]=3199;de[y+8>>2]=1650;br(D,1100,y)|0;yr(D,b)|0;r=de[f>>2]|0}n=n<<32-r|de[u>>2];de[u>>2]=n}while((r|0)<7);else n=de[u>>2]|0;de[u>>2]=n<<7;de[f>>2]=r+-7;r=(n>>>25)+11|0;if(r>>>0>a>>>0){r=0;break e}r=r+i|0;break r}default:{if((r+-19|0)>>>0>=2){M=90;break t}o=de[f>>2]|0;if((r|0)==19){if((o|0)<2){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[x>>2]=1154;de[x+4>>2]=3199;de[x+8>>2]=1650;br(D,1100,x)|0;yr(D,w)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<2)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<2;de[f>>2]=r+-2;o=(n>>>30)+3|0}else{if((o|0)<6){n=o;while(1){r=de[s>>2]|0;if((r|0)==(de[l>>2]|0))o=0;else{de[s>>2]=r+1;o=me[r>>0]|0}r=n+8|0;de[f>>2]=r;if((r|0)>=33){de[T>>2]=1154;de[T+4>>2]=3199;de[T+8>>2]=1650;br(D,1100,T)|0;yr(D,k)|0;r=de[f>>2]|0}n=o<<32-r|de[u>>2];de[u>>2]=n;if((r|0)<6)n=r;else break}}else{n=de[u>>2]|0;r=o}de[u>>2]=n<<6;de[f>>2]=r+-6;o=(n>>>26)+7|0}if((i|0)==0|o>>>0>a>>>0){r=0;break e}r=i+-1|0;if((de[d>>2]|0)>>>0<=r>>>0){de[P>>2]=1154;de[P+4>>2]=903;de[P+8>>2]=1781;br(D,1100,P)|0;yr(D,S)|0}n=pe[(de[p>>2]|0)+r>>0]|0;if(!(n<<24>>24)){r=0;break e}r=o+i|0;if(i>>>0>=r>>>0){r=i;break r}do{if((de[d>>2]|0)>>>0<=i>>>0){de[E>>2]=1154;de[E+4>>2]=903;de[E+8>>2]=1781;br(D,1100,E)|0;yr(D,A)|0}pe[(de[p>>2]|0)+i>>0]=n;i=i+1|0}while((i|0)!=(r|0))}}}while(0);if(O>>>0>r>>>0)i=r;else break}if((M|0)==90){de[C>>2]=1154;de[C+4>>2]=3140;de[C+8>>2]=1632;br(D,1100,C)|0;yr(D,I)|0;r=0;break}if((O|0)==(r|0))r=pt(t)|0;else r=0}else r=0}else{pe[R+16>>0]=1;r=0}}while(0);ct(R);t=r;ve=z;return t|0}function mt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+544|0;s=h+16|0;a=h;o=h+24|0;if(!t){u=0;ve=h;return u|0}if(t>>>0<=16){u=vt(e,t)|0;ve=h;return u|0}l=vt(e,t+-16|0)|0;u=e+20|0;t=de[u>>2]|0;if((t|0)<16){i=e+4|0;n=e+8|0;r=e+16|0;do{e=de[i>>2]|0;if((e|0)==(de[n>>2]|0))e=0;else{de[i>>2]=e+1;e=me[e>>0]|0}t=t+8|0;de[u>>2]=t;if((t|0)>=33){de[a>>2]=1154;de[a+4>>2]=3199;de[a+8>>2]=1650;br(o,1100,a)|0;yr(o,s)|0;t=de[u>>2]|0}e=e<<32-t|de[r>>2];de[r>>2]=e}while((t|0)<16)}else{e=e+16|0;r=e;e=de[e>>2]|0}de[r>>2]=e<<16;de[u>>2]=t+-16;u=e>>>16|l<<16;ve=h;return u|0}function gt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0;y=ve;ve=ve+608|0;m=y+88|0;d=y+72|0;f=y+64|0;c=y+48|0;h=y+40|0;p=y+24|0;u=y+16|0;l=y;v=y+96|0;g=de[t+20>>2]|0;_=e+20|0;s=de[_>>2]|0;do{if((s|0)<24){a=e+4|0;i=de[a>>2]|0;n=de[e+8>>2]|0;r=i>>>0>>0;if((s|0)>=16){if(r){de[a>>2]=i+1;r=me[i>>0]|0}else r=0;de[_>>2]=s+8;a=e+16|0;o=r<<24-s|de[a>>2];de[a>>2]=o;break}if(r){o=(me[i>>0]|0)<<8;r=i+1|0}else{o=0;r=i}if(r>>>0>>0){i=me[r>>0]|0;r=r+1|0}else i=0;de[a>>2]=r;de[_>>2]=s+16;a=e+16|0;o=(i|o)<<16-s|de[a>>2];de[a>>2]=o}else{o=e+16|0;a=o;o=de[o>>2]|0}}while(0);n=(o>>>16)+1|0;do{if(n>>>0<=(de[g+16>>2]|0)>>>0){i=de[(de[g+168>>2]|0)+(o>>>(32-(de[g+8>>2]|0)|0)<<2)>>2]|0;if((i|0)==-1){de[l>>2]=1154;de[l+4>>2]=3244;de[l+8>>2]=1677;br(v,1100,l)|0;yr(v,u)|0}r=i&65535;i=i>>>16;if((de[t+8>>2]|0)>>>0<=r>>>0){de[p>>2]=1154;de[p+4>>2]=902;de[p+8>>2]=1781;br(v,1100,p)|0;yr(v,h)|0}if((me[(de[t+4>>2]|0)+r>>0]|0|0)!=(i|0)){de[c>>2]=1154;de[c+4>>2]=3248;de[c+8>>2]=1694;br(v,1100,c)|0;yr(v,f)|0}}else{i=de[g+20>>2]|0;while(1){r=i+-1|0;if(n>>>0>(de[g+28+(r<<2)>>2]|0)>>>0)i=i+1|0;else break}r=(o>>>(32-i|0))+(de[g+96+(r<<2)>>2]|0)|0;if(r>>>0<(de[t>>2]|0)>>>0){r=ge[(de[g+176>>2]|0)+(r<<1)>>1]|0;break}de[d>>2]=1154;de[d+4>>2]=3266;de[d+8>>2]=1632;br(v,1100,d)|0;yr(v,m)|0;_=0;ve=y;return _|0}}while(0);de[a>>2]=de[a>>2]<>2]=(de[_>>2]|0)-i;_=r;ve=y;return _|0}function vt(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+560|0;s=h+40|0;l=h+24|0;r=h;a=h+48|0;if(t>>>0>=33){de[r>>2]=1154;de[r+4>>2]=3190;de[r+8>>2]=1634;br(a,1100,r)|0;yr(a,h+16|0)|0}u=e+20|0;r=de[u>>2]|0;if((r|0)>=(t|0)){o=e+16|0;a=o;o=de[o>>2]|0;s=r;l=32-t|0;l=o>>>l;o=o<>2]=o;t=s-t|0;de[u>>2]=t;ve=h;return l|0}n=e+4|0;o=e+8|0;i=e+16|0;do{e=de[n>>2]|0;if((e|0)==(de[o>>2]|0))e=0;else{de[n>>2]=e+1;e=me[e>>0]|0}r=r+8|0;de[u>>2]=r;if((r|0)>=33){de[l>>2]=1154;de[l+4>>2]=3199;de[l+8>>2]=1650;br(a,1100,l)|0;yr(a,s)|0;r=de[u>>2]|0}e=e<<32-r|de[i>>2];de[i>>2]=e}while((r|0)<(t|0));l=32-t|0;l=e>>>l;s=e<>2]=s;t=r-t|0;de[u>>2]=t;ve=h;return l|0}function _t(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0;d=ve;ve=ve+544|0;f=d+16|0;c=d;h=d+24|0;if((e|0)==0|t>>>0<62){p=0;ve=d;return p|0}u=at(300,0)|0;if(!u){p=0;ve=d;return p|0}de[u>>2]=519686845;r=u+4|0;de[r>>2]=0;i=u+8|0;de[i>>2]=0;l=u+88|0;n=u+136|0;o=u+160|0;a=l;s=a+44|0;do{de[a>>2]=0;a=a+4|0}while((a|0)<(s|0));pe[l+44>>0]=0;m=u+184|0;a=u+208|0;s=u+232|0;g=u+252|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+268|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;g=u+284|0;de[g>>2]=0;de[g+4>>2]=0;de[g+8>>2]=0;pe[g+12>>0]=0;de[n>>2]=0;de[n+4>>2]=0;de[n+8>>2]=0;de[n+12>>2]=0;de[n+16>>2]=0;pe[n+20>>0]=0;de[o>>2]=0;de[o+4>>2]=0;de[o+8>>2]=0;de[o+12>>2]=0;de[o+16>>2]=0;pe[o+20>>0]=0;de[m>>2]=0;de[m+4>>2]=0;de[m+8>>2]=0;de[m+12>>2]=0;de[m+16>>2]=0;pe[m+20>>0]=0;de[a>>2]=0;de[a+4>>2]=0;de[a+8>>2]=0;de[a+12>>2]=0;de[a+16>>2]=0;pe[a+20>>0]=0;de[s>>2]=0;de[s+4>>2]=0;de[s+8>>2]=0;de[s+12>>2]=0;pe[s+16>>0]=0;do{if(((t>>>0>=74?((me[e>>0]|0)<<8|(me[e+1>>0]|0)|0)==18552:0)?((me[e+2>>0]|0)<<8|(me[e+3>>0]|0))>>>0>=74:0)?((me[e+7>>0]|0)<<16|(me[e+6>>0]|0)<<24|(me[e+8>>0]|0)<<8|(me[e+9>>0]|0))>>>0<=t>>>0:0){de[l>>2]=e;de[r>>2]=e;de[i>>2]=t;if(Et(u)|0){r=de[l>>2]|0;if((me[r+39>>0]|0)<<8|(me[r+40>>0]|0)){if(!(At(u)|0))break;if(!(Ct(u)|0))break;r=de[l>>2]|0}if(!((me[r+55>>0]|0)<<8|(me[r+56>>0]|0))){g=u;ve=d;return g|0}if(It(u)|0?Ot(u)|0:0){g=u;ve=d;return g|0}}}else p=7}while(0);if((p|0)==7)de[l>>2]=0;Lt(u);if(!(u&7)){Di[de[104>>2]&1](u,0,0,1,de[27]|0)|0;g=0;ve=d;return g|0}else{de[c>>2]=1154;de[c+4>>2]=2499;de[c+8>>2]=1516;br(h,1100,c)|0;yr(h,f)|0;g=0;ve=d;return g|0}return 0}function yt(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+544|0;u=h;l=h+24|0;o=de[e+88>>2]|0;s=(me[o+70+(n<<2)+1>>0]|0)<<16|(me[o+70+(n<<2)>>0]|0)<<24|(me[o+70+(n<<2)+2>>0]|0)<<8|(me[o+70+(n<<2)+3>>0]|0);a=n+1|0;if(a>>>0<(me[o+16>>0]|0)>>>0)o=(me[o+70+(a<<2)+1>>0]|0)<<16|(me[o+70+(a<<2)>>0]|0)<<24|(me[o+70+(a<<2)+2>>0]|0)<<8|(me[o+70+(a<<2)+3>>0]|0);else o=de[e+8>>2]|0;if(o>>>0>s>>>0){l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}de[u>>2]=1154;de[u+4>>2]=3704;de[u+8>>2]=1792;br(l,1100,u)|0;yr(l,h+16|0)|0;l=e+4|0;l=de[l>>2]|0;l=l+s|0;u=o-s|0;u=bt(e,l,u,t,r,i,n)|0;ve=h;return u|0}function bt(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;var s=0,l=0,u=0,h=0;h=de[e+88>>2]|0;l=((me[h+12>>0]|0)<<8|(me[h+13>>0]|0))>>>a;u=((me[h+14>>0]|0)<<8|(me[h+15>>0]|0))>>>a;l=l>>>0>1?(l+3|0)>>>2:1;u=u>>>0>1?(u+3|0)>>>2:1;h=h+18|0;a=pe[h>>0]|0;a=_e(a<<24>>24==0|a<<24>>24==9?8:16,l)|0;if(o)if((o&3|0)==0&a>>>0<=o>>>0)a=o;else{e=0;return e|0}if((_e(a,u)|0)>>>0>n>>>0){e=0;return e|0}o=(l+1|0)>>>1;s=(u+1|0)>>>1;if(!r){e=0;return e|0}de[e+92>>2]=t;de[e+96>>2]=t;de[e+104>>2]=r;de[e+100>>2]=t+r;de[e+108>>2]=0;de[e+112>>2]=0;switch(me[h>>0]|0|0){case 0:{Mt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 4:case 6:case 5:case 3:case 2:{Dt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 9:{Rt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}case 8:case 7:{zt(e,i,n,a,l,u,o,s)|0;e=1;return e|0}default:{e=0;return e|0}}return 0}function xt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+4>>2]|0}function wt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+8>>2]|0}function Tt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+12>>2]|0}function kt(e,t){e=e|0;t=t|0;var r=0,i=0;i=ve;ve=ve+48|0;r=i;de[r>>2]=40;ut(e,t,r)|0;ve=i;return de[r+32>>2]|0}function Pt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0;l=ve;ve=ve+576|0;a=l+56|0;o=l+40|0;n=l+64|0;u=l;de[u>>2]=40;ut(e,t,u)|0;i=(((de[u+4>>2]|0)>>>r)+3|0)>>>2;t=(((de[u+8>>2]|0)>>>r)+3|0)>>>2;r=u+32|0;e=de[r+4>>2]|0;do{switch(de[r>>2]|0){case 0:{if(!e)e=8;else s=13;break}case 1:{if(!e)s=12;else s=13;break}case 2:{if(!e)s=12;else s=13;break}case 3:{if(!e)s=12;else s=13;break}case 4:{if(!e)s=12;else s=13;break}case 5:{if(!e)s=12;else s=13;break}case 6:{if(!e)s=12;else s=13;break}case 7:{if(!e)s=12;else s=13;break}case 8:{if(!e)s=12;else s=13;break}case 9:{if(!e)e=8;else s=13;break}default:s=13}}while(0);if((s|0)==12)e=16;else if((s|0)==13){de[o>>2]=1154;de[o+4>>2]=2663;de[o+8>>2]=1535;br(n,1100,o)|0;yr(n,a)|0;e=0}u=_e(_e(t,i)|0,e)|0;ve=l;return u|0}function St(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;d=ve;ve=ve+608|0;f=d+80|0;p=d+64|0;s=d+56|0;a=d+40|0;h=d+88|0;m=d;c=d+84|0;de[m>>2]=40;ut(e,t,m)|0;l=(((de[m+4>>2]|0)>>>n)+3|0)>>>2;m=m+32|0;o=de[m+4>>2]|0;do{switch(de[m>>2]|0){case 0:{if(!o)o=8;else u=13;break}case 1:{if(!o)u=12;else u=13;break}case 2:{if(!o)u=12;else u=13;break}case 3:{if(!o)u=12;else u=13;break}case 4:{if(!o)u=12;else u=13;break}case 5:{if(!o)u=12;else u=13;break}case 6:{if(!o)u=12;else u=13;break}case 7:{if(!o)u=12;else u=13;break}case 8:{if(!o)u=12;else u=13;break}case 9:{if(!o)o=8;else u=13;break}default:u=13}}while(0);if((u|0)==12)o=16;else if((u|0)==13){de[a>>2]=1154;de[a+4>>2]=2663;de[a+8>>2]=1535;br(h,1100,a)|0;yr(h,s)|0;o=0}s=_e(o,l)|0;a=_t(e,t)|0;de[c>>2]=r;o=(a|0)==0;if(!(n>>>0>15|(i>>>0<8|o))?(de[a>>2]|0)==519686845:0)yt(a,c,i,s,n)|0;if(o){ve=d;return}if((de[a>>2]|0)!=519686845){ve=d;return}Lt(a);if(!(a&7)){Di[de[104>>2]&1](a,0,0,1,de[27]|0)|0;ve=d;return}else{de[p>>2]=1154;de[p+4>>2]=2499;de[p+8>>2]=1516;br(h,1100,p)|0;yr(h,f)|0;ve=d;return}}function Et(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;a=e+92|0;i=de[e+4>>2]|0;o=e+88|0;n=de[o>>2]|0;t=(me[n+68>>0]|0)<<8|(me[n+67>>0]|0)<<16|(me[n+69>>0]|0);r=i+t|0;n=(me[n+65>>0]|0)<<8|(me[n+66>>0]|0);if(!n){e=0;return e|0}de[a>>2]=r;de[e+96>>2]=r;de[e+104>>2]=n;de[e+100>>2]=i+(n+t);de[e+108>>2]=0;de[e+112>>2]=0;if(!(dt(a,e+116|0)|0)){e=0;return e|0}t=de[o>>2]|0;do{if(!((me[t+39>>0]|0)<<8|(me[t+40>>0]|0))){if(!((me[t+55>>0]|0)<<8|(me[t+56>>0]|0))){e=0;return e|0}}else{if(!(dt(a,e+140|0)|0)){e=0;return e|0}if(dt(a,e+188|0)|0){t=de[o>>2]|0;break}else{e=0;return e|0}}}while(0);if((me[t+55>>0]|0)<<8|(me[t+56>>0]|0)){if(!(dt(a,e+164|0)|0)){e=0;return e|0}if(!(dt(a,e+212|0)|0)){e=0;return e|0}}e=1;return e|0}function At(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ve;ve=ve+592|0;l=d+16|0;s=d;a=d+72|0;p=d+24|0;i=e+88|0;t=de[i>>2]|0;f=(me[t+39>>0]|0)<<8|(me[t+40>>0]|0);h=e+236|0;o=e+240|0;r=de[o>>2]|0;if((r|0)!=(f|0)){if(r>>>0<=f>>>0){do{if((de[e+244>>2]|0)>>>0>>0){if(nt(h,f,(r+1|0)==(f|0),4,0)|0){t=de[o>>2]|0;break}pe[e+248>>0]=1;p=0;ve=d;return p|0}else t=r}while(0);Yr((de[h>>2]|0)+(t<<2)|0,0,f-t<<2|0)|0;t=de[i>>2]|0}de[o>>2]=f}u=e+92|0;r=de[e+4>>2]|0;i=(me[t+34>>0]|0)<<8|(me[t+33>>0]|0)<<16|(me[t+35>>0]|0);n=r+i|0;t=(me[t+37>>0]|0)<<8|(me[t+36>>0]|0)<<16|(me[t+38>>0]|0);if(!t){p=0;ve=d;return p|0}de[u>>2]=n;de[e+96>>2]=n;de[e+104>>2]=t;de[e+100>>2]=r+(t+i);de[e+108>>2]=0;de[e+112>>2]=0;de[p+20>>2]=0;de[p>>2]=0;de[p+4>>2]=0;de[p+8>>2]=0;de[p+12>>2]=0;pe[p+16>>0]=0;e=p+24|0;de[p+44>>2]=0;de[e>>2]=0;de[e+4>>2]=0;de[e+8>>2]=0;de[e+12>>2]=0;pe[e+16>>0]=0;if(dt(u,p)|0?(c=p+24|0,dt(u,c)|0):0){if(!(de[o>>2]|0)){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(a,l)|0}if(!f)t=1;else{i=0;n=0;o=0;t=0;a=0;e=0;s=0;r=de[h>>2]|0;while(1){i=(gt(u,p)|0)+i&31;n=(gt(u,c)|0)+n&63;o=(gt(u,p)|0)+o&31;t=(gt(u,p)|0)+t|0;a=(gt(u,c)|0)+a&63;e=(gt(u,p)|0)+e&31;de[r>>2]=n<<5|i<<11|o|t<<27|a<<21|e<<16;s=s+1|0;if((s|0)==(f|0)){t=1;break}else{t=t&31;r=r+4|0}}}}else t=0;ct(p+24|0);ct(p);p=t;ve=d;return p|0}function Ct(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0;P=ve;ve=ve+1024|0;s=P+16|0;a=P;o=P+504|0;k=P+480|0;w=P+284|0;T=P+88|0;x=P+24|0;n=de[e+88>>2]|0;b=(me[n+47>>0]|0)<<8|(me[n+48>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+42>>0]|0)<<8|(me[n+41>>0]|0)<<16|(me[n+43>>0]|0);i=t+r|0;n=(me[n+45>>0]|0)<<8|(me[n+44>>0]|0)<<16|(me[n+46>>0]|0);if(!n){k=0;ve=P;return k|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-3;n=-3;while(1){de[w+(r<<2)>>2]=i;de[T+(r<<2)>>2]=n;t=(i|0)>2;r=r+1|0;if((r|0)==49)break;else{i=t?-3:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+252|0;r=e+256|0;t=de[r>>2]|0;e:do{if((t|0)==(b|0))l=13;else{if(t>>>0<=b>>>0){do{if((de[e+260>>2]|0)>>>0>>0)if(nt(_,b,(t+1|0)==(b|0),4,0)|0){t=de[r>>2]|0;break}else{pe[e+264>>0]=1;t=0;break e}}while(0);Yr((de[_>>2]|0)+(t<<2)|0,0,b-t<<2|0)|0}de[r>>2]=b;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{S=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(S<<2)>>2]|0)&3;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(S<<2)>>2]|0)&3;t=t+1|0}while((t|0)!=8);de[r>>2]=(me[1725+(de[i>>2]|0)>>0]|0)<<2|(me[1725+(de[x>>2]|0)>>0]|0)|(me[1725+(de[n>>2]|0)>>0]|0)<<4|(me[1725+(de[e>>2]|0)>>0]|0)<<6|(me[1725+(de[o>>2]|0)>>0]|0)<<8|(me[1725+(de[a>>2]|0)>>0]|0)<<10|(me[1725+(de[s>>2]|0)>>0]|0)<<12|(me[1725+(de[l>>2]|0)>>0]|0)<<14|(me[1725+(de[u>>2]|0)>>0]|0)<<16|(me[1725+(de[h>>2]|0)>>0]|0)<<18|(me[1725+(de[c>>2]|0)>>0]|0)<<20|(me[1725+(de[f>>2]|0)>>0]|0)<<22|(me[1725+(de[p>>2]|0)>>0]|0)<<24|(me[1725+(de[d>>2]|0)>>0]|0)<<26|(me[1725+(de[m>>2]|0)>>0]|0)<<28|(me[1725+(de[g>>2]|0)>>0]|0)<<30;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+4|0}}}while(0)}else t=0;ct(k);E=t;ve=P;return E|0}function It(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ve;ve=ve+560|0;l=f+16|0;s=f;a=f+48|0;c=f+24|0;n=de[e+88>>2]|0;h=(me[n+55>>0]|0)<<8|(me[n+56>>0]|0);u=e+92|0;t=de[e+4>>2]|0;r=(me[n+50>>0]|0)<<8|(me[n+49>>0]|0)<<16|(me[n+51>>0]|0);i=t+r|0;n=(me[n+53>>0]|0)<<8|(me[n+52>>0]|0)<<16|(me[n+54>>0]|0);if(!n){c=0;ve=f;return c|0}de[u>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[c+20>>2]=0;de[c>>2]=0;de[c+4>>2]=0;de[c+8>>2]=0;de[c+12>>2]=0;pe[c+16>>0]=0;e:do{if(dt(u,c)|0){o=e+268|0;r=e+272|0;t=de[r>>2]|0;if((t|0)!=(h|0)){if(t>>>0<=h>>>0){do{if((de[e+276>>2]|0)>>>0>>0)if(nt(o,h,(t+1|0)==(h|0),2,0)|0){t=de[r>>2]|0;break}else{pe[e+280>>0]=1;t=0;break e}}while(0);Yr((de[o>>2]|0)+(t<<1)|0,0,h-t<<1|0)|0}de[r>>2]=h}if(!h){de[s>>2]=1154;de[s+4>>2]=903;de[s+8>>2]=1781;br(a,1100,s)|0;yr(a,l)|0;t=1;break}r=0;i=0;n=0;t=de[o>>2]|0;while(1){l=gt(u,c)|0;r=l+r&255;i=(gt(u,c)|0)+i&255;$[t>>1]=i<<8|r;n=n+1|0;if((n|0)==(h|0)){t=1;break}else t=t+2|0}}else t=0}while(0);ct(c);c=t;ve=f;return c|0}function Ot(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0;P=ve;ve=ve+2432|0;s=P+16|0;a=P;o=P+1912|0;k=P+1888|0;w=P+988|0;T=P+88|0;x=P+24|0;n=de[e+88>>2]|0;b=(me[n+63>>0]|0)<<8|(me[n+64>>0]|0);y=e+92|0;t=de[e+4>>2]|0;r=(me[n+58>>0]|0)<<8|(me[n+57>>0]|0)<<16|(me[n+59>>0]|0);i=t+r|0;n=(me[n+61>>0]|0)<<8|(me[n+60>>0]|0)<<16|(me[n+62>>0]|0);if(!n){k=0;ve=P;return k|0}de[y>>2]=i;de[e+96>>2]=i;de[e+104>>2]=n;de[e+100>>2]=t+(n+r);de[e+108>>2]=0;de[e+112>>2]=0;de[k+20>>2]=0;de[k>>2]=0;de[k+4>>2]=0;de[k+8>>2]=0;de[k+12>>2]=0;pe[k+16>>0]=0;if(dt(y,k)|0){r=0;i=-7;n=-7;while(1){de[w+(r<<2)>>2]=i;de[T+(r<<2)>>2]=n;t=(i|0)>6;r=r+1|0;if((r|0)==225)break;else{i=t?-7:i+1|0;n=(t&1)+n|0}}t=x;r=t+64|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(r|0));_=e+284|0;r=b*3|0;i=e+288|0;t=de[i>>2]|0;e:do{if((t|0)==(r|0))l=13;else{if(t>>>0<=r>>>0){do{if((de[e+292>>2]|0)>>>0>>0)if(nt(_,r,(t+1|0)==(r|0),2,0)|0){t=de[i>>2]|0;break}else{pe[e+296>>0]=1;t=0;break e}}while(0);Yr((de[_>>2]|0)+(t<<1)|0,0,r-t<<1|0)|0}de[i>>2]=r;l=13}}while(0);do{if((l|0)==13){if(!b){de[a>>2]=1154;de[a+4>>2]=903;de[a+8>>2]=1781;br(o,1100,a)|0;yr(o,s)|0;t=1;break}i=x+4|0;n=x+8|0;e=x+12|0;o=x+16|0;a=x+20|0;s=x+24|0;l=x+28|0;u=x+32|0;h=x+36|0;c=x+40|0;f=x+44|0;p=x+48|0;d=x+52|0;m=x+56|0;g=x+60|0;v=0;r=de[_>>2]|0;while(1){t=0;do{S=gt(y,k)|0;_=t<<1;E=x+(_<<2)|0;de[E>>2]=(de[E>>2]|0)+(de[w+(S<<2)>>2]|0)&7;_=x+((_|1)<<2)|0;de[_>>2]=(de[_>>2]|0)+(de[T+(S<<2)>>2]|0)&7;t=t+1|0}while((t|0)!=8);S=me[1729+(de[a>>2]|0)>>0]|0;$[r>>1]=(me[1729+(de[i>>2]|0)>>0]|0)<<3|(me[1729+(de[x>>2]|0)>>0]|0)|(me[1729+(de[n>>2]|0)>>0]|0)<<6|(me[1729+(de[e>>2]|0)>>0]|0)<<9|(me[1729+(de[o>>2]|0)>>0]|0)<<12|S<<15;E=me[1729+(de[c>>2]|0)>>0]|0;$[r+2>>1]=(me[1729+(de[s>>2]|0)>>0]|0)<<2|S>>>1|(me[1729+(de[l>>2]|0)>>0]|0)<<5|(me[1729+(de[u>>2]|0)>>0]|0)<<8|(me[1729+(de[h>>2]|0)>>0]|0)<<11|E<<14;$[r+4>>1]=(me[1729+(de[f>>2]|0)>>0]|0)<<1|E>>>2|(me[1729+(de[p>>2]|0)>>0]|0)<<4|(me[1729+(de[d>>2]|0)>>0]|0)<<7|(me[1729+(de[m>>2]|0)>>0]|0)<<10|(me[1729+(de[g>>2]|0)>>0]|0)<<13;v=v+1|0;if((v|0)==(b|0)){t=1;break}else r=r+6|0}}}while(0)}else t=0;ct(k);E=t;ve=P;return E|0}function Mt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0,N=0,B=0,U=0,X=0,H=0,G=0,W=0,q=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;he=ve;ve=ve+720|0;ue=he+184|0;se=he+168|0;ae=he+160|0;oe=he+144|0;ne=he+136|0;ie=he+120|0;re=he+112|0;ee=he+96|0;$=he+88|0;Q=he+72|0;K=he+64|0;J=he+48|0;Z=he+40|0;le=he+24|0;te=he+16|0;Y=he;q=he+208|0;V=he+192|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;G=de[H>>2]|0;r=pe[(de[e+88>>2]|0)+17>>0]|0;W=i>>>2;if(!(r<<24>>24)){ve=he;return 1}U=(s|0)==0;X=s+-1|0;M=(o&1|0)!=0;D=i<<1;R=e+92|0;z=e+116|0;L=e+140|0;F=e+236|0;j=a+-1|0;O=(n&1|0)!=0;I=e+188|0;P=e+252|0;S=W+1|0;E=W+2|0;A=W+3|0;C=j<<4;T=r&255;r=0;o=0;n=1;k=0;do{if(!U){x=de[t+(k<<2)>>2]|0;w=0;while(1){_=w&1;l=(_|0)==0;v=(_<<5^32)+-16|0;_=(_<<1^2)+-1|0;b=l?a:-1;u=l?0:j;e=(w|0)==(X|0);y=M&e;if((u|0)!=(b|0)){g=M&e^1;m=l?x:x+C|0;while(1){if((n|0)==1)n=gt(R,z)|0|512;d=n&7;n=n>>>3;l=me[1823+d>>0]|0;e=0;do{f=(gt(R,L)|0)+o|0;p=f-B|0;o=p>>31;o=o&f|p&~o;if((de[N>>2]|0)>>>0<=o>>>0){de[Y>>2]=1154;de[Y+4>>2]=903;de[Y+8>>2]=1781;br(q,1100,Y)|0;yr(q,te)|0}de[V+(e<<2)>>2]=de[(de[F>>2]|0)+(o<<2)>>2];e=e+1|0}while(e>>>0>>0);p=O&(u|0)==(j|0);if(y|p){f=0;do{h=_e(f,i)|0;e=m+h|0;l=(f|0)==0|g;c=f<<1;fe=(gt(R,I)|0)+r|0;ce=fe-G|0;r=ce>>31;r=r&fe|ce&~r;do{if(p){if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(q,1100,oe)|0;yr(q,ae)|0}de[m+(h+4)>>2]=de[(de[P>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r}else{if(!l){ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;break}de[e>>2]=de[V+((me[1831+(d<<2)+c>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(q,1100,ie)|0;yr(q,ne)|0}de[m+(h+4)>>2]=de[(de[P>>2]|0)+(r<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;de[m+(h+8)>>2]=de[V+((me[(c|1)+(1831+(d<<2))>>0]|0)<<2)>>2];if((de[H>>2]|0)>>>0<=r>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(q,1100,se)|0;yr(q,ue)|0}de[m+(h+12)>>2]=de[(de[P>>2]|0)+(r<<2)>>2]}}while(0);f=f+1|0}while((f|0)!=2)}else{de[m>>2]=de[V+((me[1831+(d<<2)>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[le>>2]=1154;de[le+4>>2]=903;de[le+8>>2]=1781;br(q,1100,le)|0;yr(q,Z)|0}de[m+4>>2]=de[(de[P>>2]|0)+(r<<2)>>2];de[m+8>>2]=de[V+((me[1831+(d<<2)+1>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(q,1100,J)|0;yr(q,K)|0}de[m+12>>2]=de[(de[P>>2]|0)+(r<<2)>>2];de[m+(W<<2)>>2]=de[V+((me[1831+(d<<2)+2>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(q,1100,Q)|0;yr(q,$)|0}de[m+(S<<2)>>2]=de[(de[P>>2]|0)+(r<<2)>>2];de[m+(E<<2)>>2]=de[V+((me[1831+(d<<2)+3>>0]|0)<<2)>>2];ce=(gt(R,I)|0)+r|0;fe=ce-G|0;r=fe>>31;r=r&ce|fe&~r;if((de[H>>2]|0)>>>0<=r>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(q,1100,ee)|0;yr(q,re)|0}de[m+(A<<2)>>2]=de[(de[P>>2]|0)+(r<<2)>>2]}u=u+_|0;if((u|0)==(b|0))break;else m=m+v|0}}w=w+1|0;if((w|0)==(s|0))break;else x=x+D|0}}k=k+1|0}while((k|0)!=(T|0));ve=he;return 1}function Dt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0,N=0,B=0,U=0,X=0,H=0,G=0,W=0,q=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,le=0,ue=0,he=0,ce=0,fe=0;ce=ve;ve=ve+640|0;le=ce+88|0;se=ce+72|0;ae=ce+64|0;oe=ce+48|0;ne=ce+40|0;he=ce+24|0;ue=ce+16|0;ie=ce;te=ce+128|0;re=ce+112|0;ee=ce+96|0;N=e+240|0;B=de[N>>2]|0;H=e+256|0;K=de[H>>2]|0;Q=e+272|0;$=de[Q>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ce;return 1}X=(s|0)==0;G=s+-1|0;W=i<<1;q=e+92|0;V=e+116|0;Y=a+-1|0;Z=e+212|0;J=e+188|0;j=(n&1|0)==0;F=(o&1|0)==0;O=e+288|0;M=e+284|0;D=e+252|0;R=e+140|0;z=e+236|0;L=e+164|0;C=e+268|0;I=Y<<5;E=r&255;r=0;n=0;o=0;e=0;l=1;A=0;do{if(!X){P=de[t+(A<<2)>>2]|0;S=0;while(1){T=S&1;u=(T|0)==0;w=(T<<6^64)+-32|0;T=(T<<1^2)+-1|0;k=u?a:-1;h=u?0:Y;if((h|0)!=(k|0)){x=F|(S|0)!=(G|0);b=u?P:P+I|0;while(1){if((l|0)==1)l=gt(q,V)|0|512;y=l&7;l=l>>>3;c=me[1823+y>>0]|0;u=0;do{v=(gt(q,L)|0)+n|0;_=v-$|0;n=_>>31;n=n&v|_&~n;if((de[Q>>2]|0)>>>0<=n>>>0){de[ie>>2]=1154;de[ie+4>>2]=903;de[ie+8>>2]=1781;br(te,1100,ie)|0;yr(te,ue)|0}de[ee+(u<<2)>>2]=ge[(de[C>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{v=(gt(q,R)|0)+e|0;_=v-B|0;e=_>>31;e=e&v|_&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[he>>2]=1154;de[he+4>>2]=903;de[he+8>>2]=1781;br(te,1100,he)|0;yr(te,ne)|0}de[re+(u<<2)>>2]=de[(de[z>>2]|0)+(e<<2)>>2];u=u+1|0}while(u>>>0>>0);_=j|(h|0)!=(Y|0);g=0;v=b;while(1){m=x|(g|0)==0;d=g<<1;f=0;p=v;while(1){c=(gt(q,Z)|0)+r|0;u=c-U|0;r=u>>31;r=r&c|u&~r;u=(gt(q,J)|0)+o|0;c=u-K|0;o=c>>31;o=o&u|c&~o;if((_|(f|0)==0)&m){u=me[f+d+(1831+(y<<2))>>0]|0;c=r*3|0;if((de[O>>2]|0)>>>0<=c>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(te,1100,oe)|0;yr(te,ae)|0}fe=de[M>>2]|0;de[p>>2]=(ge[fe+(c<<1)>>1]|0)<<16|de[ee+(u<<2)>>2];de[p+4>>2]=(ge[fe+(c+2<<1)>>1]|0)<<16|(ge[fe+(c+1<<1)>>1]|0);de[p+8>>2]=de[re+(u<<2)>>2];if((de[H>>2]|0)>>>0<=o>>>0){de[se>>2]=1154;de[se+4>>2]=903;de[se+8>>2]=1781;br(te,1100,se)|0;yr(te,le)|0}de[p+12>>2]=de[(de[D>>2]|0)+(o<<2)>>2]}f=f+1|0;if((f|0)==2)break;else p=p+16|0}g=g+1|0;if((g|0)==2)break;else v=v+i|0}h=h+T|0;if((h|0)==(k|0))break;else b=b+w|0}}S=S+1|0;if((S|0)==(s|0))break;else P=P+W|0}}A=A+1|0}while((A|0)!=(E|0));ve=ce;return 1}function Rt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0,N=0,B=0,U=0,X=0,H=0,G=0,W=0,q=0,V=0,Y=0,Z=0,J=0,K=0;K=ve;ve=ve+608|0;Y=K+64|0;V=K+48|0;q=K+40|0;J=K+24|0;Z=K+16|0;W=K;G=K+88|0;H=K+72|0;D=e+272|0;R=de[D>>2]|0;r=de[e+88>>2]|0;z=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=K;return 1}L=(s|0)==0;F=s+-1|0;j=i<<1;N=e+92|0;B=e+116|0;U=a+-1|0;X=e+212|0;M=(o&1|0)==0;C=e+288|0;I=e+284|0;O=e+164|0;E=e+268|0;A=U<<4;S=r&255;P=(n&1|0)!=0;r=0;o=0;e=1;k=0;do{if(!L){w=de[t+(k<<2)>>2]|0;T=0;while(1){b=T&1;n=(b|0)==0;y=(b<<5^32)+-16|0;b=(b<<1^2)+-1|0;x=n?a:-1;l=n?0:U;if((l|0)!=(x|0)){_=M|(T|0)!=(F|0);v=n?w:w+A|0;while(1){if((e|0)==1)e=gt(N,B)|0|512;g=e&7;e=e>>>3;u=me[1823+g>>0]|0;n=0;do{d=(gt(N,O)|0)+o|0;m=d-R|0;o=m>>31;o=o&d|m&~o;if((de[D>>2]|0)>>>0<=o>>>0){de[W>>2]=1154;de[W+4>>2]=903;de[W+8>>2]=1781;br(G,1100,W)|0;yr(G,Z)|0}de[H+(n<<2)>>2]=ge[(de[E>>2]|0)+(o<<1)>>1];n=n+1|0}while(n>>>0>>0);m=(l|0)==(U|0)&P;p=0;d=v;while(1){f=_|(p|0)==0;c=p<<1;n=(gt(N,X)|0)+r|0;h=n-z|0;u=h>>31;u=u&n|h&~u;if(f){r=me[1831+(g<<2)+c>>0]|0;n=u*3|0;if((de[C>>2]|0)>>>0<=n>>>0){de[J>>2]=1154;de[J+4>>2]=903;de[J+8>>2]=1781;br(G,1100,J)|0;yr(G,q)|0}h=de[I>>2]|0;de[d>>2]=(ge[h+(n<<1)>>1]|0)<<16|de[H+(r<<2)>>2];de[d+4>>2]=(ge[h+(n+2<<1)>>1]|0)<<16|(ge[h+(n+1<<1)>>1]|0)}h=d+8|0;n=(gt(N,X)|0)+u|0;u=n-z|0;r=u>>31;r=r&n|u&~r;if(!(m|f^1)){n=me[(c|1)+(1831+(g<<2))>>0]|0;u=r*3|0;if((de[C>>2]|0)>>>0<=u>>>0){de[V>>2]=1154;de[V+4>>2]=903;de[V+8>>2]=1781;br(G,1100,V)|0;yr(G,Y)|0}f=de[I>>2]|0;de[h>>2]=(ge[f+(u<<1)>>1]|0)<<16|de[H+(n<<2)>>2];de[d+12>>2]=(ge[f+(u+2<<1)>>1]|0)<<16|(ge[f+(u+1<<1)>>1]|0)}p=p+1|0;if((p|0)==2)break;else d=d+i|0}l=l+b|0;if((l|0)==(x|0))break;else v=v+y|0}}T=T+1|0;if((T|0)==(s|0))break;else w=w+j|0}}k=k+1|0}while((k|0)!=(S|0));ve=K;return 1}function zt(e,t,r,i,n,o,a,s){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;s=s|0;var l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0,N=0,B=0,U=0,X=0,H=0,G=0,W=0,q=0,V=0,Y=0,Z=0,J=0,K=0,Q=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0;ae=ve;ve=ve+640|0;ie=ae+88|0;re=ae+72|0;te=ae+64|0;ee=ae+48|0;$=ae+40|0;oe=ae+24|0;ne=ae+16|0;Q=ae;K=ae+128|0;Z=ae+112|0;J=ae+96|0;N=e+272|0;B=de[N>>2]|0;r=de[e+88>>2]|0;U=(me[r+63>>0]|0)<<8|(me[r+64>>0]|0);r=pe[r+17>>0]|0;if(!(r<<24>>24)){ve=ae;return 1}X=(s|0)==0;H=s+-1|0;G=i<<1;W=e+92|0;q=e+116|0;V=a+-1|0;Y=e+212|0;j=(n&1|0)==0;F=(o&1|0)==0;R=e+288|0;z=e+284|0;L=e+164|0;M=e+268|0;D=V<<5;I=r&255;r=0;n=0;o=0;e=0;l=1;O=0;do{if(!X){A=de[t+(O<<2)>>2]|0;C=0;while(1){S=C&1;u=(S|0)==0;P=(S<<6^64)+-32|0;S=(S<<1^2)+-1|0;E=u?a:-1;h=u?0:V;if((h|0)!=(E|0)){k=F|(C|0)!=(H|0);T=u?A:A+D|0;while(1){if((l|0)==1)l=gt(W,q)|0|512;w=l&7;l=l>>>3;c=me[1823+w>>0]|0;u=0;do{b=(gt(W,L)|0)+e|0;x=b-B|0;e=x>>31;e=e&b|x&~e;if((de[N>>2]|0)>>>0<=e>>>0){de[Q>>2]=1154;de[Q+4>>2]=903;de[Q+8>>2]=1781;br(K,1100,Q)|0;yr(K,ne)|0}de[Z+(u<<2)>>2]=ge[(de[M>>2]|0)+(e<<1)>>1];u=u+1|0}while(u>>>0>>0);u=0;do{b=(gt(W,L)|0)+n|0;x=b-B|0;n=x>>31;n=n&b|x&~n;if((de[N>>2]|0)>>>0<=n>>>0){de[oe>>2]=1154;de[oe+4>>2]=903;de[oe+8>>2]=1781;br(K,1100,oe)|0;yr(K,$)|0}de[J+(u<<2)>>2]=ge[(de[M>>2]|0)+(n<<1)>>1];u=u+1|0}while(u>>>0>>0);x=j|(h|0)!=(V|0);y=0;b=T;while(1){_=k|(y|0)==0;v=y<<1;m=0;g=b;while(1){d=(gt(W,Y)|0)+o|0;p=d-U|0;o=p>>31;o=o&d|p&~o;p=(gt(W,Y)|0)+r|0;d=p-U|0;r=d>>31;r=r&p|d&~r;if((x|(m|0)==0)&_){p=me[m+v+(1831+(w<<2))>>0]|0;d=o*3|0;u=de[R>>2]|0;if(u>>>0<=d>>>0){de[ee>>2]=1154;de[ee+4>>2]=903;de[ee+8>>2]=1781;br(K,1100,ee)|0;yr(K,te)|0;u=de[R>>2]|0}c=de[z>>2]|0;f=r*3|0;if(u>>>0>f>>>0)u=c;else{de[re>>2]=1154;de[re+4>>2]=903;de[re+8>>2]=1781;br(K,1100,re)|0;yr(K,ie)|0;u=de[z>>2]|0}de[g>>2]=(ge[c+(d<<1)>>1]|0)<<16|de[Z+(p<<2)>>2];de[g+4>>2]=(ge[c+(d+2<<1)>>1]|0)<<16|(ge[c+(d+1<<1)>>1]|0);de[g+8>>2]=(ge[u+(f<<1)>>1]|0)<<16|de[J+(p<<2)>>2];de[g+12>>2]=(ge[u+(f+2<<1)>>1]|0)<<16|(ge[u+(f+1<<1)>>1]|0)}m=m+1|0;if((m|0)==2)break;else g=g+16|0}y=y+1|0;if((y|0)==2)break;else b=b+i|0}h=h+S|0;if((h|0)==(E|0))break;else T=T+P|0}}C=C+1|0;if((C|0)==(s|0))break;else A=A+G|0}}O=O+1|0}while((O|0)!=(I|0));ve=ae;return 1}function Lt(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0;f=ve;ve=ve+608|0;c=f+88|0;h=f+72|0;l=f+64|0;s=f+48|0;o=f+40|0;a=f+24|0;n=f+16|0;i=f;u=f+96|0;de[e>>2]=0;t=e+284|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[i>>2]=1154;de[i+4>>2]=2499;de[i+8>>2]=1516;br(u,1100,i)|0;yr(u,n)|0}de[t>>2]=0;de[e+288>>2]=0;de[e+292>>2]=0}pe[e+296>>0]=0;t=e+268|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[a>>2]=1154;de[a+4>>2]=2499;de[a+8>>2]=1516;br(u,1100,a)|0;yr(u,o)|0}de[t>>2]=0;de[e+272>>2]=0;de[e+276>>2]=0}pe[e+280>>0]=0;t=e+252|0;r=de[t>>2]|0;if(r){if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[s>>2]=1154;de[s+4>>2]=2499;de[s+8>>2]=1516;br(u,1100,s)|0;yr(u,l)|0}de[t>>2]=0;de[e+256>>2]=0;de[e+260>>2]=0}pe[e+264>>0]=0;t=e+236|0;r=de[t>>2]|0;if(!r){c=e+248|0;pe[c>>0]=0;c=e+212|0;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}if(!(r&7))Di[de[104>>2]&1](r,0,0,1,de[27]|0)|0;else{de[h>>2]=1154;de[h+4>>2]=2499;de[h+8>>2]=1516;br(u,1100,h)|0;yr(u,c)|0}de[t>>2]=0;de[e+240>>2]=0;de[e+244>>2]=0;c=e+248|0;pe[c>>0]=0;c=e+212|0;ct(c);c=e+188|0;ct(c);c=e+164|0;ct(c);c=e+140|0;ct(c);c=e+116|0;ct(c);ve=f;return}function Ft(e,t){e=e|0;t=t|0;var r=0;r=ve;ve=ve+16|0;de[r>>2]=t;t=de[63]|0;xr(t,e,r)|0;vr(10,t)|0;Xe()}function jt(){var e=0,t=0;e=ve;ve=ve+16|0;if(!(Le(200,2)|0)){t=Re(de[49]|0)|0;ve=e;return t|0}else Ft(2090,e);return 0}function Nt(e){e=e|0;Ur(e);return}function Bt(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Oi[e&3]();Ft(2139,t)}function Ut(){var e=0,t=0;e=jt()|0;if(((e|0)!=0?(t=de[e>>2]|0,(t|0)!=0):0)?(e=t+48|0,(de[e>>2]&-256|0)==1126902528?(de[e+4>>2]|0)==1129074247:0):0)Bt(de[t+12>>2]|0);t=de[28]|0;de[28]=t+0;Bt(t)}function Xt(e){e=e|0;return}function Ht(e){e=e|0;return}function Gt(e){e=e|0;return}function Wt(e){e=e|0;return}function qt(e){e=e|0;Nt(e);return}function Vt(e){e=e|0;Nt(e);return}function Yt(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;a=ve;ve=ve+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(n=Qt(t,24,40,0)|0,(n|0)!=0):0){t=o;i=t+56|0;do{de[t>>2]=0;t=t+4|0}while((t|0)<(i|0));de[o>>2]=n;de[o+8>>2]=e;de[o+12>>2]=-1;de[o+48>>2]=1;Ri[de[(de[n>>2]|0)+28>>2]&3](n,o,de[r>>2]|0,1);if((de[o+24>>2]|0)==1){de[r>>2]=de[o+16>>2];t=1}else t=0}else t=0;else t=1;ve=a;return t|0}function Zt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0;e=t+16|0;n=de[e>>2]|0;do{if(n){if((n|0)!=(r|0)){i=t+36|0;de[i>>2]=(de[i>>2]|0)+1;de[t+24>>2]=2;pe[t+54>>0]=1;break}e=t+24|0;if((de[e>>2]|0)==2)de[e>>2]=i}else{de[e>>2]=r;de[t+24>>2]=i;de[t+36>>2]=1}}while(0);return}function Jt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);return}function Kt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;if((e|0)==(de[t+8>>2]|0))Zt(0,t,r,i);else{e=de[e+8>>2]|0;Ri[de[(de[e>>2]|0)+28>>2]&3](e,t,r,i)}return}function Qt(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0;p=ve;ve=ve+64|0;f=p;c=de[e>>2]|0;h=e+(de[c+-8>>2]|0)|0;c=de[c+-4>>2]|0;de[f>>2]=r;de[f+4>>2]=e;de[f+8>>2]=t;de[f+12>>2]=i;i=f+16|0;e=f+20|0;t=f+24|0;n=f+28|0;o=f+32|0;a=f+40|0;s=(c|0)==(r|0);l=i;u=l+36|0;do{de[l>>2]=0;l=l+4|0}while((l|0)<(u|0));$[i+36>>1]=0;pe[i+38>>0]=0;e:do{if(s){de[f+48>>2]=1;Mi[de[(de[r>>2]|0)+20>>2]&3](r,f,h,h,1,0);i=(de[t>>2]|0)==1?h:0}else{Ei[de[(de[c>>2]|0)+24>>2]&3](c,f,h,1,0);switch(de[f+36>>2]|0){case 0:{i=(de[a>>2]|0)==1&(de[n>>2]|0)==1&(de[o>>2]|0)==1?de[e>>2]|0:0;break e}case 1:break;default:{i=0;break e}}if((de[t>>2]|0)!=1?!((de[a>>2]|0)==0&(de[n>>2]|0)==1&(de[o>>2]|0)==1):0){i=0;break}i=de[i>>2]|0}}while(0);ve=p;return i|0}function $t(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;pe[t+53>>0]=1;do{if((de[t+4>>2]|0)==(i|0)){pe[t+52>>0]=1;i=t+16|0;e=de[i>>2]|0;if(!e){de[i>>2]=r;de[t+24>>2]=n;de[t+36>>2]=1;if(!((n|0)==1?(de[t+48>>2]|0)==1:0))break;pe[t+54>>0]=1;break}if((e|0)!=(r|0)){n=t+36|0;de[n>>2]=(de[n>>2]|0)+1;pe[t+54>>0]=1;break}e=t+24|0;i=de[e>>2]|0;if((i|0)==2){de[e>>2]=n;i=n}if((i|0)==1?(de[t+48>>2]|0)==1:0)pe[t+54>>0]=1}}while(0);return}function er(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0;e:do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(o=t+28|0,(de[o>>2]|0)!=1):0)de[o>>2]=i}else{if((e|0)!=(de[t>>2]|0)){s=de[e+8>>2]|0;Ei[de[(de[s>>2]|0)+24>>2]&3](s,t,r,i,n);break}if((de[t+16>>2]|0)!=(r|0)?(a=t+20|0,(de[a>>2]|0)!=(r|0)):0){de[t+32>>2]=i;i=t+44|0;if((de[i>>2]|0)==4)break;o=t+52|0;pe[o>>0]=0;l=t+53|0;pe[l>>0]=0;e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,r,1,n);if(pe[l>>0]|0){if(!(pe[o>>0]|0)){o=1;s=13}}else{o=0;s=13}do{if((s|0)==13){de[a>>2]=r;l=t+40|0;de[l>>2]=(de[l>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0){pe[t+54>>0]=1;if(o)break}else s=16;if((s|0)==16?o:0)break;de[i>>2]=4;break e}}while(0);de[i>>2]=3;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function tr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0;do{if((e|0)==(de[t+8>>2]|0)){if((de[t+4>>2]|0)==(r|0)?(a=t+28|0,(de[a>>2]|0)!=1):0)de[a>>2]=i}else if((e|0)==(de[t>>2]|0)){if((de[t+16>>2]|0)!=(r|0)?(o=t+20|0,(de[o>>2]|0)!=(r|0)):0){de[t+32>>2]=i;de[o>>2]=r;n=t+40|0;de[n>>2]=(de[n>>2]|0)+1;if((de[t+36>>2]|0)==1?(de[t+24>>2]|0)==2:0)pe[t+54>>0]=1;de[t+44>>2]=4;break}if((i|0)==1)de[t+32>>2]=1}}while(0);return}function rr(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))$t(0,t,r,i,n);else{e=de[e+8>>2]|0;Mi[de[(de[e>>2]|0)+20>>2]&3](e,t,r,i,n,o)}return}function ir(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;if((e|0)==(de[t+8>>2]|0))$t(0,t,r,i,n);return}function nr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+16|0;i=n;de[i>>2]=de[r>>2];e=Si[de[(de[e>>2]|0)+16>>2]&7](e,t,i)|0;if(e)de[r>>2]=de[i>>2];ve=n;return e&1|0}function or(e){e=e|0;if(!e)e=0;else e=(Qt(e,24,72,0)|0)!=0;return e&1|0}function ar(){var e=0,t=0,r=0,i=0,n=0,o=0,a=0,s=0;n=ve;ve=ve+48|0;a=n+32|0;r=n+24|0;s=n+16|0;o=n;n=n+36|0;e=jt()|0;if((e|0)!=0?(i=de[e>>2]|0,(i|0)!=0):0){e=i+48|0;t=de[e>>2]|0;e=de[e+4>>2]|0;if(!((t&-256|0)==1126902528&(e|0)==1129074247)){de[r>>2]=de[51];Ft(2368,r)}if((t|0)==1126902529&(e|0)==1129074247)e=de[i+44>>2]|0;else e=i+80|0;de[n>>2]=e;i=de[i>>2]|0;e=de[i+4>>2]|0;if(Si[de[(de[8>>2]|0)+16>>2]&7](8,i,n)|0){s=de[n>>2]|0;n=de[51]|0;s=Ci[de[(de[s>>2]|0)+8>>2]&1](s)|0;de[o>>2]=n;de[o+4>>2]=e;de[o+8>>2]=s;Ft(2282,o)}else{de[s>>2]=de[51];de[s+4>>2]=e;Ft(2327,s)}}Ft(2406,a)}function sr(){var e=0;e=ve;ve=ve+16|0;if(!(Fe(196,6)|0)){ve=e;return}else Ft(2179,e)}function lr(e){e=e|0;var t=0;t=ve;ve=ve+16|0;Ur(e);if(!(Be(de[49]|0,0)|0)){ve=t;return}else Ft(2229,t)}function ur(e){e=e|0;var t=0,r=0;t=0;while(1){if((me[2427+t>>0]|0)==(e|0)){r=2;break}t=t+1|0;if((t|0)==87){t=87;e=2515;r=5;break}}if((r|0)==2)if(!t)e=2515;else{e=2515;r=5}if((r|0)==5)while(1){r=e;while(1){e=r+1|0;if(!(pe[r>>0]|0))break;else r=e}t=t+-1|0;if(!t)break;else r=5}return e|0}function hr(){var e=0;if(!(de[52]|0))e=264;else{e=(ze()|0)+60|0;e=de[e>>2]|0}return e|0}function cr(e){e=e|0;var t=0;if(e>>>0>4294963200){t=hr()|0;de[t>>2]=0-e;e=-1}return e|0}function fr(e,t){e=+e;t=t|0;var r=0,i=0,n=0;ee[te>>3]=e;r=de[te>>2]|0;i=de[te+4>>2]|0;n=Zr(r|0,i|0,52)|0;n=n&2047;switch(n|0){case 0:{if(e!=0.0){e=+fr(e*18446744073709552.0e3,t);r=(de[t>>2]|0)+-64|0}else r=0;de[t>>2]=r;break}case 2047:break;default:{de[t>>2]=n+-1022;de[te>>2]=r;de[te+4>>2]=i&-2146435073|1071644672;e=+ee[te>>3]}}return+e}function pr(e,t){e=+e;t=t|0;return+ +fr(e,t)}function dr(e,t,r){e=e|0;t=t|0;r=r|0;do{if(e){if(t>>>0<128){pe[e>>0]=t;e=1;break}if(t>>>0<2048){pe[e>>0]=t>>>6|192;pe[e+1>>0]=t&63|128;e=2;break}if(t>>>0<55296|(t&-8192|0)==57344){pe[e>>0]=t>>>12|224;pe[e+1>>0]=t>>>6&63|128;pe[e+2>>0]=t&63|128;e=3;break}if((t+-65536|0)>>>0<1048576){pe[e>>0]=t>>>18|240;pe[e+1>>0]=t>>>12&63|128;pe[e+2>>0]=t>>>6&63|128;pe[e+3>>0]=t&63|128;e=4;break}else{e=hr()|0;de[e>>2]=84;e=-1;break}}else e=1}while(0);return e|0}function mr(e,t){e=e|0;t=t|0;if(!e)e=0;else e=dr(e,t,0)|0;return e|0}function gr(e){e=e|0;var t=0,r=0;do{if(e){if((de[e+76>>2]|0)<=-1){t=Dr(e)|0;break}r=(kr(e)|0)==0;t=Dr(e)|0;if(!r)Pr(e)}else{if(!(de[65]|0))t=0;else t=gr(de[65]|0)|0;Ue(236);e=de[58]|0;if(e)do{if((de[e+76>>2]|0)>-1)r=kr(e)|0;else r=0;if((de[e+20>>2]|0)>>>0>(de[e+28>>2]|0)>>>0)t=Dr(e)|0|t;if(r)Pr(e);e=de[e+56>>2]|0}while((e|0)!=0);je(236)}}while(0);return t|0}function vr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0;if((de[t+76>>2]|0)>=0?(kr(t)|0)!=0:0){if((pe[t+75>>0]|0)!=(e|0)?(i=t+20|0,n=de[i>>2]|0,n>>>0<(de[t+16>>2]|0)>>>0):0){de[i>>2]=n+1;pe[n>>0]=e;r=e&255}else r=Sr(t,e)|0;Pr(t)}else a=3;do{if((a|0)==3){if((pe[t+75>>0]|0)!=(e|0)?(o=t+20|0,r=de[o>>2]|0,r>>>0<(de[t+16>>2]|0)>>>0):0){de[o>>2]=r+1;pe[r>>0]=e;r=e&255;break}r=Sr(t,e)|0}}while(0);return r|0}function _r(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=r+16|0;n=de[i>>2]|0;if(!n)if(!(Or(r)|0)){n=de[i>>2]|0;o=4}else i=0;else o=4;e:do{if((o|0)==4){a=r+20|0;o=de[a>>2]|0;if((n-o|0)>>>0>>0){i=Si[de[r+36>>2]&7](r,e,t)|0;break}t:do{if((pe[r+75>>0]|0)>-1){i=t;while(1){if(!i){n=o;i=0;break t}n=i+-1|0;if((pe[e+n>>0]|0)==10)break;else i=n}if((Si[de[r+36>>2]&7](r,e,i)|0)>>>0>>0)break e;t=t-i|0;e=e+i|0;n=de[a>>2]|0}else{n=o;i=0}}while(0);Qr(n|0,e|0,t|0)|0;de[a>>2]=(de[a>>2]|0)+t;i=i+t|0}}while(0);return i|0}function yr(e,t){e=e|0;t=t|0;var r=0,i=0;r=ve;ve=ve+16|0;i=r;de[i>>2]=t;t=xr(de[64]|0,e,i)|0;ve=r;return t|0}function br(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=ve;ve=ve+16|0;n=i;de[n>>2]=r;r=Tr(e,t,n)|0;ve=i;return r|0}function xr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0;m=ve;ve=ve+224|0;c=m+120|0;d=m+80|0;p=m;f=m+136|0;i=d;n=i+40|0;do{de[i>>2]=0;i=i+4|0}while((i|0)<(n|0));de[c>>2]=de[r>>2];if((Rr(0,t,c,p,d)|0)<0)r=-1;else{if((de[e+76>>2]|0)>-1)u=kr(e)|0;else u=0;r=de[e>>2]|0;h=r&32;if((pe[e+74>>0]|0)<1)de[e>>2]=r&-33;r=e+48|0;if(!(de[r>>2]|0)){n=e+44|0;o=de[n>>2]|0;de[n>>2]=f;a=e+28|0;de[a>>2]=f;s=e+20|0;de[s>>2]=f;de[r>>2]=80;l=e+16|0;de[l>>2]=f+80;i=Rr(e,t,c,p,d)|0;if(o){Si[de[e+36>>2]&7](e,0,0)|0;i=(de[s>>2]|0)==0?-1:i;de[n>>2]=o;de[r>>2]=0;de[l>>2]=0;de[a>>2]=0;de[s>>2]=0}}else i=Rr(e,t,c,p,d)|0;r=de[e>>2]|0;de[e>>2]=r|h;if(u)Pr(e);r=(r&32|0)==0?i:-1}ve=m;return r|0}function wr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0,h=0;h=ve;ve=ve+128|0;n=h+112|0;u=h;o=u;a=268;s=o+112|0;do{de[o>>2]=de[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(s|0));if((t+-1|0)>>>0>2147483646)if(!t){t=1;l=4}else{t=hr()|0;de[t>>2]=75;t=-1}else{n=e;l=4}if((l|0)==4){l=-2-n|0;l=t>>>0>l>>>0?l:t;de[u+48>>2]=l;e=u+20|0;de[e>>2]=n;de[u+44>>2]=n;t=n+l|0;n=u+16|0;de[n>>2]=t;de[u+28>>2]=t;t=xr(u,r,i)|0;if(l){r=de[e>>2]|0;pe[r+(((r|0)==(de[n>>2]|0))<<31>>31)>>0]=0}}ve=h;return t|0}function Tr(e,t,r){e=e|0;t=t|0;r=r|0;return wr(e,2147483647,t,r)|0}function kr(e){e=e|0;return 0}function Pr(e){e=e|0;return}function Sr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0;l=ve;ve=ve+16|0;s=l;a=t&255;pe[s>>0]=a;i=e+16|0;n=de[i>>2]|0;if(!n)if(!(Or(e)|0)){n=de[i>>2]|0;o=4}else r=-1;else o=4;do{if((o|0)==4){i=e+20|0;o=de[i>>2]|0;if(o>>>0>>0?(r=t&255,(r|0)!=(pe[e+75>>0]|0)):0){de[i>>2]=o+1;pe[o>>0]=a;break}if((Si[de[e+36>>2]&7](e,s,1)|0)==1)r=me[s>>0]|0;else r=-1}}while(0);ve=l;return r|0}function Er(e){e=e|0;var t=0,r=0;t=ve;ve=ve+16|0;r=t;de[r>>2]=de[e+60>>2];e=cr(Se(6,r|0)|0)|0;ve=t;return e|0}function Ar(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0;n=ve;ve=ve+32|0;o=n;i=n+20|0;de[o>>2]=de[e+60>>2];de[o+4>>2]=0;de[o+8>>2]=t;de[o+12>>2]=i;de[o+16>>2]=r;if((cr(We(140,o|0)|0)|0)<0){de[i>>2]=-1;e=-1}else e=de[i>>2]|0;ve=n;return e|0}function Cr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;d=ve;ve=ve+48|0;c=d+16|0;h=d;i=d+32|0;f=e+28|0;n=de[f>>2]|0;de[i>>2]=n;p=e+20|0;n=(de[p>>2]|0)-n|0;de[i+4>>2]=n;de[i+8>>2]=t;de[i+12>>2]=r;l=e+60|0;u=e+44|0;t=2;n=n+r|0;while(1){if(!(de[52]|0)){de[c>>2]=de[l>>2];de[c+4>>2]=i;de[c+8>>2]=t;a=cr(qe(146,c|0)|0)|0}else{He(7,e|0);de[h>>2]=de[l>>2];de[h+4>>2]=i;de[h+8>>2]=t;a=cr(qe(146,h|0)|0)|0;ke(0)}if((n|0)==(a|0)){n=6;break}if((a|0)<0){n=8;break}n=n-a|0;o=de[i+4>>2]|0;if(a>>>0<=o>>>0)if((t|0)==2){de[f>>2]=(de[f>>2]|0)+a;s=o;t=2}else s=o;else{s=de[u>>2]|0;de[f>>2]=s;de[p>>2]=s;s=de[i+12>>2]|0;a=a-o|0;i=i+8|0;t=t+-1|0}de[i>>2]=(de[i>>2]|0)+a;de[i+4>>2]=s-a}if((n|0)==6){c=de[u>>2]|0;de[e+16>>2]=c+(de[e+48>>2]|0);e=c;de[f>>2]=e;de[p>>2]=e}else if((n|0)==8){de[e+16>>2]=0;de[f>>2]=0;de[p>>2]=0;de[e>>2]=de[e>>2]|32;if((t|0)==2)r=0;else r=r-(de[i+4>>2]|0)|0}ve=d;return r|0}function Ir(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;n=ve;ve=ve+80|0;i=n;de[e+36>>2]=3;if((de[e>>2]&64|0)==0?(de[i>>2]=de[e+60>>2],de[i+4>>2]=21505,de[i+8>>2]=n+12,(Pe(54,i|0)|0)!=0):0)pe[e+75>>0]=-1;i=Cr(e,t,r)|0;ve=n;return i|0}function Or(e){e=e|0;var t=0,r=0;t=e+74|0;r=pe[t>>0]|0;pe[t>>0]=r+255|r;t=de[e>>2]|0;if(!(t&8)){de[e+8>>2]=0;de[e+4>>2]=0;t=de[e+44>>2]|0;de[e+28>>2]=t;de[e+20>>2]=t;de[e+16>>2]=t+(de[e+48>>2]|0);t=0}else{de[e>>2]=t|32;t=-1}return t|0}function Mr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;o=t&255;i=(r|0)!=0;e:do{if(i&(e&3|0)!=0){n=t&255;while(1){if((pe[e>>0]|0)==n<<24>>24){a=6;break e}e=e+1|0;r=r+-1|0;i=(r|0)!=0;if(!(i&(e&3|0)!=0)){a=5;break}}}else a=5}while(0);if((a|0)==5)if(i)a=6;else r=0;e:do{if((a|0)==6){n=t&255;if((pe[e>>0]|0)!=n<<24>>24){i=_e(o,16843009)|0;t:do{if(r>>>0>3)while(1){o=de[e>>2]^i;if((o&-2139062144^-2139062144)&o+-16843009)break;e=e+4|0;r=r+-4|0;if(r>>>0<=3){a=11;break t}}else a=11}while(0);if((a|0)==11)if(!r){r=0;break}while(1){if((pe[e>>0]|0)==n<<24>>24)break e;e=e+1|0;r=r+-1|0;if(!r){r=0;break}}}}}while(0);return((r|0)!=0?e:0)|0}function Dr(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0;t=e+20|0;o=e+28|0;if((de[t>>2]|0)>>>0>(de[o>>2]|0)>>>0?(Si[de[e+36>>2]&7](e,0,0)|0,(de[t>>2]|0)==0):0)t=-1;else{a=e+4|0;r=de[a>>2]|0;i=e+8|0;n=de[i>>2]|0;if(r>>>0>>0)Si[de[e+40>>2]&7](e,r-n|0,1)|0;de[e+16>>2]=0;de[o>>2]=0;de[t>>2]=0;de[i>>2]=0;de[a>>2]=0;t=0}return t|0}function Rr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0.0,h=0,c=0,f=0,p=0,d=0.0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0,j=0,N=0,B=0,U=0,X=0,H=0,G=0,W=0,q=0,V=0,Y=0,Z=0,J=0,K=0,Q=0;Q=ve;ve=ve+624|0;V=Q+24|0;Z=Q+16|0;Y=Q+588|0;X=Q+576|0;q=Q;N=Q+536|0;K=Q+8|0;J=Q+528|0;I=(e|0)!=0;O=N+40|0;j=O;N=N+39|0;B=K+4|0;U=X+12|0;X=X+11|0;H=Y;G=U;W=G-H|0;M=-2-H|0;D=G+2|0;R=V+288|0;z=Y+9|0;L=z;F=Y+8|0;o=0;m=t;a=0;t=0;e:while(1){do{if((o|0)>-1)if((a|0)>(2147483647-o|0)){o=hr()|0;de[o>>2]=75;o=-1;break}else{o=a+o|0;break}}while(0);a=pe[m>>0]|0;if(!(a<<24>>24)){C=245;break}else s=m;t:while(1){switch(a<<24>>24){case 37:{a=s;C=9;break t}case 0:{a=s;break t}default:{}}A=s+1|0;a=pe[A>>0]|0;s=A}t:do{if((C|0)==9)while(1){C=0;if((pe[a+1>>0]|0)!=37)break t;s=s+1|0;a=a+2|0;if((pe[a>>0]|0)==37)C=9;else break}}while(0);v=s-m|0;if(I?(de[e>>2]&32|0)==0:0)_r(m,v,e)|0;if((s|0)!=(m|0)){m=a;a=v;continue}h=a+1|0;s=pe[h>>0]|0;l=(s<<24>>24)+-48|0;if(l>>>0<10){A=(pe[a+2>>0]|0)==36;h=A?a+3|0:h;s=pe[h>>0]|0;p=A?l:-1;t=A?1:t}else p=-1;a=s<<24>>24;t:do{if((a&-32|0)==32){l=0;while(1){if(!(1<>24)+-32|l;h=h+1|0;s=pe[h>>0]|0;a=s<<24>>24;if((a&-32|0)!=32){c=l;a=h;break}}}else{c=0;a=h}}while(0);do{if(s<<24>>24==42){l=a+1|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+2>>0]|0)==36:0){de[n+(s<<2)>>2]=10;t=1;a=a+3|0;s=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0}else{if(t){o=-1;break e}if(!I){g=c;a=l;t=0;A=0;break}t=(de[r>>2]|0)+(4-1)&~(4-1);s=de[t>>2]|0;de[r>>2]=t+4;t=0;a=l}if((s|0)<0){g=c|8192;A=0-s|0}else{g=c;A=s}}else{l=(s<<24>>24)+-48|0;if(l>>>0<10){s=0;do{s=(s*10|0)+l|0;a=a+1|0;l=(pe[a>>0]|0)+-48|0}while(l>>>0<10);if((s|0)<0){o=-1;break e}else{g=c;A=s}}else{g=c;A=0}}}while(0);t:do{if((pe[a>>0]|0)==46){l=a+1|0;s=pe[l>>0]|0;if(s<<24>>24!=42){h=(s<<24>>24)+-48|0;if(h>>>0<10){a=l;s=0}else{a=l;h=0;break}while(1){s=(s*10|0)+h|0;a=a+1|0;h=(pe[a>>0]|0)+-48|0;if(h>>>0>=10){h=s;break t}}}l=a+2|0;s=(pe[l>>0]|0)+-48|0;if(s>>>0<10?(pe[a+3>>0]|0)==36:0){de[n+(s<<2)>>2]=10;a=a+4|0;h=de[i+((pe[l>>0]|0)+-48<<3)>>2]|0;break}if(t){o=-1;break e}if(I){a=(de[r>>2]|0)+(4-1)&~(4-1);h=de[a>>2]|0;de[r>>2]=a+4;a=l}else{a=l;h=0}}else h=-1}while(0);f=0;while(1){s=(pe[a>>0]|0)+-65|0;if(s>>>0>57){o=-1;break e}l=a+1|0;s=pe[5359+(f*58|0)+s>>0]|0;c=s&255;if((c+-1|0)>>>0<8){a=l;f=c}else{E=l;break}}if(!(s<<24>>24)){o=-1;break}l=(p|0)>-1;do{if(s<<24>>24==19)if(l){o=-1;break e}else C=52;else{if(l){de[n+(p<<2)>>2]=c;P=i+(p<<3)|0;S=de[P+4>>2]|0;C=q;de[C>>2]=de[P>>2];de[C+4>>2]=S;C=52;break}if(!I){o=0;break e}Fr(q,c,r)}}while(0);if((C|0)==52?(C=0,!I):0){m=E;a=v;continue}p=pe[a>>0]|0;p=(f|0)!=0&(p&15|0)==3?p&-33:p;l=g&-65537;S=(g&8192|0)==0?g:l;t:do{switch(p|0){case 110:switch(f|0){case 0:{de[de[q>>2]>>2]=o;m=E;a=v;continue e}case 1:{de[de[q>>2]>>2]=o;m=E;a=v;continue e}case 2:{m=de[q>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}case 3:{$[de[q>>2]>>1]=o;m=E;a=v;continue e}case 4:{pe[de[q>>2]>>0]=o;m=E;a=v;continue e}case 6:{de[de[q>>2]>>2]=o;m=E;a=v;continue e}case 7:{m=de[q>>2]|0;de[m>>2]=o;de[m+4>>2]=((o|0)<0)<<31>>31;m=E;a=v;continue e}default:{m=E;a=v;continue e}}case 112:{f=S|8;h=h>>>0>8?h:8;p=120;C=64;break}case 88:case 120:{f=S;C=64;break}case 111:{l=q;s=de[l>>2]|0;l=de[l+4>>2]|0;if((s|0)==0&(l|0)==0)a=O;else{a=O;do{a=a+-1|0;pe[a>>0]=s&7|48;s=Zr(s|0,l|0,3)|0;l=re}while(!((s|0)==0&(l|0)==0))}if(!(S&8)){s=S;f=0;c=5839;C=77}else{f=j-a+1|0;s=S;h=(h|0)<(f|0)?f:h;f=0;c=5839;C=77}break}case 105:case 100:{s=q;a=de[s>>2]|0;s=de[s+4>>2]|0;if((s|0)<0){a=Vr(0,0,a|0,s|0)|0;s=re;l=q;de[l>>2]=a;de[l+4>>2]=s;l=1;c=5839;C=76;break t}if(!(S&2048)){c=S&1;l=c;c=(c|0)==0?5839:5841;C=76}else{l=1;c=5840;C=76}break}case 117:{s=q;a=de[s>>2]|0;s=de[s+4>>2]|0;l=0;c=5839;C=76;break}case 99:{pe[N>>0]=de[q>>2];m=N;s=1;f=0;p=5839;a=O;break}case 109:{a=hr()|0;a=ur(de[a>>2]|0)|0;C=82;break}case 115:{a=de[q>>2]|0;a=(a|0)!=0?a:5849;C=82;break}case 67:{de[K>>2]=de[q>>2];de[B>>2]=0;de[q>>2]=K;h=-1;C=86;break}case 83:{if(!h){Nr(e,32,A,0,S);a=0;C=98}else C=86;break}case 65:case 71:case 70:case 69:case 97:case 103:case 102:case 101:{u=+ee[q>>3];de[Z>>2]=0;ee[te>>3]=u;if((de[te+4>>2]|0)>=0)if(!(S&2048)){P=S&1;k=P;P=(P|0)==0?5857:5862}else{k=1;P=5859}else{u=-u;k=1;P=5856}ee[te>>3]=u;T=de[te+4>>2]&2146435072;do{if(T>>>0<2146435072|(T|0)==2146435072&0<0){d=+pr(u,Z)*2.0;s=d!=0.0;if(s)de[Z>>2]=(de[Z>>2]|0)+-1;x=p|32;if((x|0)==97){m=p&32;v=(m|0)==0?P:P+9|0;g=k|2;a=12-h|0;do{if(!(h>>>0>11|(a|0)==0)){u=8.0;do{a=a+-1|0;u=u*16.0}while((a|0)!=0);if((pe[v>>0]|0)==45){u=-(u+(-d-u));break}else{u=d+u-u;break}}else u=d}while(0);s=de[Z>>2]|0;a=(s|0)<0?0-s|0:s;a=jr(a,((a|0)<0)<<31>>31,U)|0;if((a|0)==(U|0)){pe[X>>0]=48;a=X}pe[a+-1>>0]=(s>>31&2)+43;f=a+-2|0;pe[f>>0]=p+15;c=(h|0)<1;l=(S&8|0)==0;s=Y;while(1){P=~~u;a=s+1|0;pe[s>>0]=me[5823+P>>0]|m;u=(u-+(P|0))*16.0;do{if((a-H|0)==1){if(l&(c&u==0.0))break;pe[a>>0]=46;a=s+2|0}}while(0);if(!(u!=0.0))break;else s=a}h=(h|0)!=0&(M+a|0)<(h|0)?D+h-f|0:W-f+a|0;l=h+g|0;Nr(e,32,A,l,S);if(!(de[e>>2]&32))_r(v,g,e)|0;Nr(e,48,A,l,S^65536);a=a-H|0;if(!(de[e>>2]&32))_r(Y,a,e)|0;s=G-f|0;Nr(e,48,h-(a+s)|0,0,0);if(!(de[e>>2]&32))_r(f,s,e)|0;Nr(e,32,A,l,S^8192);a=(l|0)<(A|0)?A:l;break}a=(h|0)<0?6:h;if(s){s=(de[Z>>2]|0)+-28|0;de[Z>>2]=s;u=d*268435456.0}else{u=d;s=de[Z>>2]|0}T=(s|0)<0?V:R;w=T;s=T;do{b=~~u>>>0;de[s>>2]=b;s=s+4|0;u=(u-+(b>>>0))*1.0e9}while(u!=0.0);l=s;s=de[Z>>2]|0;if((s|0)>0){c=T;while(1){f=(s|0)>29?29:s;h=l+-4|0;do{if(h>>>0>>0)h=c;else{s=0;do{b=Jr(de[h>>2]|0,0,f|0)|0;b=Kr(b|0,re|0,s|0,0)|0;s=re;y=ai(b|0,s|0,1e9,0)|0;de[h>>2]=y;s=oi(b|0,s|0,1e9,0)|0;h=h+-4|0}while(h>>>0>=c>>>0);if(!s){h=c;break}h=c+-4|0;de[h>>2]=s}}while(0);while(1){if(l>>>0<=h>>>0)break;s=l+-4|0;if(!(de[s>>2]|0))l=s;else break}s=(de[Z>>2]|0)-f|0;de[Z>>2]=s;if((s|0)>0)c=h;else break}}else h=T;if((s|0)<0){v=((a+25|0)/9|0)+1|0;_=(x|0)==102;m=h;while(1){g=0-s|0;g=(g|0)>9?9:g;do{if(m>>>0>>0){s=(1<>>g;h=0;f=m;do{b=de[f>>2]|0;de[f>>2]=(b>>>g)+h;h=_e(b&s,c)|0;f=f+4|0}while(f>>>0>>0);s=(de[m>>2]|0)==0?m+4|0:m;if(!h){h=s;break}de[l>>2]=h;h=s;l=l+4|0}else h=(de[m>>2]|0)==0?m+4|0:m}while(0);s=_?T:h;l=(l-s>>2|0)>(v|0)?s+(v<<2)|0:l;s=(de[Z>>2]|0)+g|0;de[Z>>2]=s;if((s|0)>=0){m=h;break}else m=h}}else m=h;do{if(m>>>0>>0){s=(w-m>>2)*9|0;c=de[m>>2]|0;if(c>>>0<10)break;else h=10;do{h=h*10|0;s=s+1|0}while(c>>>0>=h>>>0)}else s=0}while(0);y=(x|0)==103;b=(a|0)!=0;h=a-((x|0)!=102?s:0)+((b&y)<<31>>31)|0;if((h|0)<(((l-w>>2)*9|0)+-9|0)){f=h+9216|0;_=(f|0)/9|0;h=T+(_+-1023<<2)|0;f=((f|0)%9|0)+1|0;if((f|0)<9){c=10;do{c=c*10|0;f=f+1|0}while((f|0)!=9)}else c=10;g=de[h>>2]|0;v=(g>>>0)%(c>>>0)|0;if((v|0)==0?(T+(_+-1022<<2)|0)==(l|0):0)c=m;else C=163;do{if((C|0)==163){C=0;d=(((g>>>0)/(c>>>0)|0)&1|0)==0?9007199254740992.0:9007199254740994.0;f=(c|0)/2|0;do{if(v>>>0>>0)u=.5;else{if((v|0)==(f|0)?(T+(_+-1022<<2)|0)==(l|0):0){u=1.0;break}u=1.5}}while(0);do{if(k){if((pe[P>>0]|0)!=45)break;d=-d;u=-u}}while(0);f=g-v|0;de[h>>2]=f;if(!(d+u!=d)){c=m;break}x=f+c|0;de[h>>2]=x;if(x>>>0>999999999){s=m;while(1){c=h+-4|0;de[h>>2]=0;if(c>>>0>>0){s=s+-4|0;de[s>>2]=0}x=(de[c>>2]|0)+1|0;de[c>>2]=x;if(x>>>0>999999999)h=c;else{m=s;h=c;break}}}s=(w-m>>2)*9|0;f=de[m>>2]|0;if(f>>>0<10){c=m;break}else c=10;do{c=c*10|0;s=s+1|0}while(f>>>0>=c>>>0);c=m}}while(0);x=h+4|0;m=c;l=l>>>0>x>>>0?x:l}v=0-s|0;while(1){if(l>>>0<=m>>>0){_=0;x=l;break}h=l+-4|0;if(!(de[h>>2]|0))l=h;else{_=1;x=l;break}}do{if(y){a=(b&1^1)+a|0;if((a|0)>(s|0)&(s|0)>-5){p=p+-1|0;a=a+-1-s|0}else{p=p+-2|0;a=a+-1|0}l=S&8;if(l)break;do{if(_){l=de[x+-4>>2]|0;if(!l){h=9;break}if(!((l>>>0)%10|0)){c=10;h=0}else{h=0;break}do{c=c*10|0;h=h+1|0}while(((l>>>0)%(c>>>0)|0|0)==0)}else h=9}while(0);l=((x-w>>2)*9|0)+-9|0;if((p|32|0)==102){l=l-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}else{l=l+s-h|0;l=(l|0)<0?0:l;a=(a|0)<(l|0)?a:l;l=0;break}}else l=S&8}while(0);g=a|l;c=(g|0)!=0&1;f=(p|32|0)==102;if(f){s=(s|0)>0?s:0;p=0}else{h=(s|0)<0?v:s;h=jr(h,((h|0)<0)<<31>>31,U)|0;if((G-h|0)<2)do{h=h+-1|0;pe[h>>0]=48}while((G-h|0)<2);pe[h+-1>>0]=(s>>31&2)+43;w=h+-2|0;pe[w>>0]=p;s=G-w|0;p=w}v=k+1+a+c+s|0;Nr(e,32,A,v,S);if(!(de[e>>2]&32))_r(P,k,e)|0;Nr(e,48,A,v,S^65536);do{if(f){h=m>>>0>T>>>0?T:m;s=h;do{l=jr(de[s>>2]|0,0,z)|0;do{if((s|0)==(h|0)){if((l|0)!=(z|0))break;pe[F>>0]=48;l=F}else{if(l>>>0<=Y>>>0)break;do{l=l+-1|0;pe[l>>0]=48}while(l>>>0>Y>>>0)}}while(0);if(!(de[e>>2]&32))_r(l,L-l|0,e)|0;s=s+4|0}while(s>>>0<=T>>>0);do{if(g){if(de[e>>2]&32)break;_r(5891,1,e)|0}}while(0);if((a|0)>0&s>>>0>>0){l=s;while(1){s=jr(de[l>>2]|0,0,z)|0;if(s>>>0>Y>>>0)do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0);if(!(de[e>>2]&32))_r(s,(a|0)>9?9:a,e)|0;l=l+4|0;s=a+-9|0;if(!((a|0)>9&l>>>0>>0)){a=s;break}else a=s}}Nr(e,48,a+9|0,9,0)}else{f=_?x:m+4|0;if((a|0)>-1){c=(l|0)==0;h=m;do{s=jr(de[h>>2]|0,0,z)|0;if((s|0)==(z|0)){pe[F>>0]=48;s=F}do{if((h|0)==(m|0)){l=s+1|0;if(!(de[e>>2]&32))_r(s,1,e)|0;if(c&(a|0)<1){s=l;break}if(de[e>>2]&32){s=l;break}_r(5891,1,e)|0;s=l}else{if(s>>>0<=Y>>>0)break;do{s=s+-1|0;pe[s>>0]=48}while(s>>>0>Y>>>0)}}while(0);l=L-s|0;if(!(de[e>>2]&32))_r(s,(a|0)>(l|0)?l:a,e)|0;a=a-l|0;h=h+4|0}while(h>>>0>>0&(a|0)>-1)}Nr(e,48,a+18|0,18,0);if(de[e>>2]&32)break;_r(p,G-p|0,e)|0}}while(0);Nr(e,32,A,v,S^8192);a=(v|0)<(A|0)?A:v}else{f=(p&32|0)!=0;c=u!=u|0.0!=0.0;s=c?0:k;h=s+3|0;Nr(e,32,A,h,l);a=de[e>>2]|0;if(!(a&32)){_r(P,s,e)|0;a=de[e>>2]|0}if(!(a&32))_r(c?f?5883:5887:f?5875:5879,3,e)|0;Nr(e,32,A,h,S^8192);a=(h|0)<(A|0)?A:h}}while(0);m=E;continue e}default:{l=S;s=h;f=0;p=5839;a=O}}}while(0);t:do{if((C|0)==64){l=q;s=de[l>>2]|0;l=de[l+4>>2]|0;c=p&32;if(!((s|0)==0&(l|0)==0)){a=O;do{a=a+-1|0;pe[a>>0]=me[5823+(s&15)>>0]|c;s=Zr(s|0,l|0,4)|0;l=re}while(!((s|0)==0&(l|0)==0));C=q;if((f&8|0)==0|(de[C>>2]|0)==0&(de[C+4>>2]|0)==0){s=f;f=0;c=5839;C=77}else{s=f;f=2;c=5839+(p>>4)|0;C=77}}else{a=O;s=f;f=0;c=5839;C=77}}else if((C|0)==76){a=jr(a,s,O)|0;s=S;f=l;C=77}else if((C|0)==82){C=0;S=Mr(a,0,h)|0;P=(S|0)==0;m=a;s=P?h:S-a|0;f=0;p=5839;a=P?a+h|0:S}else if((C|0)==86){C=0;s=0;a=0;c=de[q>>2]|0;while(1){l=de[c>>2]|0;if(!l)break;a=mr(J,l)|0;if((a|0)<0|a>>>0>(h-s|0)>>>0)break;s=a+s|0;if(h>>>0>s>>>0)c=c+4|0;else break}if((a|0)<0){o=-1;break e}Nr(e,32,A,s,S);if(!s){a=0;C=98}else{l=0;h=de[q>>2]|0;while(1){a=de[h>>2]|0;if(!a){a=s;C=98;break t}a=mr(J,a)|0;l=a+l|0;if((l|0)>(s|0)){a=s;C=98;break t}if(!(de[e>>2]&32))_r(J,a,e)|0;if(l>>>0>=s>>>0){a=s;C=98;break}else h=h+4|0}}}}while(0);if((C|0)==98){C=0;Nr(e,32,A,a,S^8192);m=E;a=(A|0)>(a|0)?A:a;continue}if((C|0)==77){C=0;l=(h|0)>-1?s&-65537:s;s=q;s=(de[s>>2]|0)!=0|(de[s+4>>2]|0)!=0;if((h|0)!=0|s){s=(s&1^1)+(j-a)|0;m=a;s=(h|0)>(s|0)?h:s;p=c;a=O}else{m=O;s=0;p=c;a=O}}c=a-m|0;s=(s|0)<(c|0)?c:s;h=f+s|0;a=(A|0)<(h|0)?h:A;Nr(e,32,a,h,l);if(!(de[e>>2]&32))_r(p,f,e)|0;Nr(e,48,a,h,l^65536);Nr(e,48,s,c,0);if(!(de[e>>2]&32))_r(m,c,e)|0;Nr(e,32,a,h,l^8192);m=E}e:do{if((C|0)==245)if(!e)if(t){o=1;while(1){t=de[n+(o<<2)>>2]|0;if(!t)break;Fr(i+(o<<3)|0,t,r);o=o+1|0;if((o|0)>=10){o=1;break e}}if((o|0)<10)while(1){if(de[n+(o<<2)>>2]|0){o=-1;break e}o=o+1|0;if((o|0)>=10){o=1;break}}else o=1}else o=0}while(0);ve=Q;return o|0}function zr(e){e=e|0;if(!(de[e+68>>2]|0))Pr(e);return}function Lr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0;i=e+20|0;n=de[i>>2]|0;e=(de[e+16>>2]|0)-n|0;e=e>>>0>r>>>0?r:e;Qr(n|0,t|0,e|0)|0;de[i>>2]=(de[i>>2]|0)+e;return r|0}function Fr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0.0;e:do{if(t>>>0<=20)do{switch(t|0){case 9:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;de[e>>2]=t;break e}case 10:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=((t|0)<0)<<31>>31;break e}case 11:{i=(de[r>>2]|0)+(4-1)&~(4-1);t=de[i>>2]|0;de[r>>2]=i+4;i=e;de[i>>2]=t;de[i+4>>2]=0;break e}case 12:{i=(de[r>>2]|0)+(8-1)&~(8-1);t=i;n=de[t>>2]|0;t=de[t+4>>2]|0;de[r>>2]=i+8;i=e;de[i>>2]=n;de[i+4>>2]=t;break e}case 13:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&65535)<<16>>16;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 14:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&65535;de[n+4>>2]=0;break e}case 15:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;i=(i&255)<<24>>24;n=e;de[n>>2]=i;de[n+4>>2]=((i|0)<0)<<31>>31;break e}case 16:{n=(de[r>>2]|0)+(4-1)&~(4-1);i=de[n>>2]|0;de[r>>2]=n+4;n=e;de[n>>2]=i&255;de[n+4>>2]=0;break e}case 17:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}case 18:{n=(de[r>>2]|0)+(8-1)&~(8-1);o=+ee[n>>3];de[r>>2]=n+8;ee[e>>3]=o;break e}default:break e}}while(0)}while(0);return}function jr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if(t>>>0>0|(t|0)==0&e>>>0>4294967295)while(1){i=ai(e|0,t|0,10,0)|0;r=r+-1|0;pe[r>>0]=i|48;i=oi(e|0,t|0,10,0)|0;if(t>>>0>9|(t|0)==9&e>>>0>4294967295){e=i;t=re}else{e=i;break}}if(e)while(1){r=r+-1|0;pe[r>>0]=(e>>>0)%10|0|48;if(e>>>0<10)break;else e=(e>>>0)/10|0}return r|0}function Nr(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0;s=ve;ve=ve+256|0;a=s;do{if((r|0)>(i|0)&(n&73728|0)==0){n=r-i|0;Yr(a|0,t|0,(n>>>0>256?256:n)|0)|0;t=de[e>>2]|0;o=(t&32|0)==0;if(n>>>0>255){i=r-i|0;do{if(o){_r(a,256,e)|0;t=de[e>>2]|0}n=n+-256|0;o=(t&32|0)==0}while(n>>>0>255);if(o)n=i&255;else break}else if(!o)break;_r(a,n,e)|0}}while(0);ve=s;return}function Br(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0,b=0,x=0,w=0,T=0,k=0,P=0,S=0,E=0,A=0,C=0,I=0,O=0,M=0,D=0,R=0,z=0,L=0,F=0;do{if(e>>>0<245){p=e>>>0<11?16:e+11&-8;e=p>>>3;s=de[151]|0;r=s>>>e;if(r&3){e=(r&1^1)+e|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;n=de[i>>2]|0;o=n+8|0;a=de[o>>2]|0;do{if((r|0)!=(a|0)){if(a>>>0<(de[155]|0)>>>0)Xe();t=a+12|0;if((de[t>>2]|0)==(n|0)){de[t>>2]=r;de[i>>2]=a;break}else Xe()}else de[151]=s&~(1<>2]=F|3;F=n+(F|4)|0;de[F>>2]=de[F>>2]|1;F=o;return F|0}a=de[153]|0;if(p>>>0>a>>>0){if(r){i=2<>>12&16;i=i>>>l;n=i>>>5&8;i=i>>>n;o=i>>>2&4;i=i>>>o;r=i>>>1&2;i=i>>>r;e=i>>>1&1;e=(n|l|o|r|e)+(i>>>e)|0;i=e<<1;r=644+(i<<2)|0;i=644+(i+2<<2)|0;o=de[i>>2]|0;l=o+8|0;n=de[l>>2]|0;do{if((r|0)!=(n|0)){if(n>>>0<(de[155]|0)>>>0)Xe();t=n+12|0;if((de[t>>2]|0)==(o|0)){de[t>>2]=r;de[i>>2]=n;u=de[153]|0;break}else Xe()}else{de[151]=s&~(1<>2]=p|3;s=o+p|0;de[o+(p|4)>>2]=a|1;de[o+F>>2]=a;if(u){n=de[156]|0;r=u>>>3;t=r<<1;i=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(t>>>0<(de[155]|0)>>>0)Xe();else{h=e;c=t}}else{de[151]=e|r;h=644+(t+2<<2)|0;c=i}de[h>>2]=n;de[c+12>>2]=n;de[n+8>>2]=c;de[n+12>>2]=i}de[153]=a;de[156]=s;F=l;return F|0}e=de[152]|0;if(e){r=(e&0-e)+-1|0;L=r>>>12&16;r=r>>>L;z=r>>>5&8;r=r>>>z;F=r>>>2&4;r=r>>>F;e=r>>>1&2;r=r>>>e;i=r>>>1&1;i=de[908+((z|L|F|e|i)+(r>>>i)<<2)>>2]|0;r=(de[i+4>>2]&-8)-p|0;e=i;while(1){t=de[e+16>>2]|0;if(!t){t=de[e+20>>2]|0;if(!t){l=r;break}}e=(de[t+4>>2]&-8)-p|0;F=e>>>0>>0;r=F?e:r;e=t;i=F?t:i}o=de[155]|0;if(i>>>0>>0)Xe();s=i+p|0;if(i>>>0>=s>>>0)Xe();a=de[i+24>>2]|0;r=de[i+12>>2]|0;do{if((r|0)==(i|0)){e=i+20|0;t=de[e>>2]|0;if(!t){e=i+16|0;t=de[e>>2]|0;if(!t){f=0;break}}while(1){r=t+20|0;n=de[r>>2]|0;if(n){t=n;e=r;continue}r=t+16|0;n=de[r>>2]|0;if(!n)break;else{t=n;e=r}}if(e>>>0>>0)Xe();else{de[e>>2]=0;f=t;break}}else{n=de[i+8>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(i|0))Xe();e=r+8|0;if((de[e>>2]|0)==(i|0)){de[t>>2]=r;de[e>>2]=n;f=r;break}else Xe()}}while(0);do{if(a){t=de[i+28>>2]|0;e=908+(t<<2)|0;if((i|0)==(de[e>>2]|0)){de[e>>2]=f;if(!f){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(i|0))de[t>>2]=f;else de[a+20>>2]=f;if(!f)break}e=de[155]|0;if(f>>>0>>0)Xe();de[f+24>>2]=a;t=de[i+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[f+16>>2]=t;de[t+24>>2]=f;break}}while(0);t=de[i+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[f+20>>2]=t;de[t+24>>2]=f;break}}}while(0);if(l>>>0<16){F=l+p|0;de[i+4>>2]=F|3;F=i+(F+4)|0;de[F>>2]=de[F>>2]|1}else{de[i+4>>2]=p|3;de[i+(p|4)>>2]=l|1;de[i+(l+p)>>2]=l;t=de[153]|0;if(t){o=de[156]|0;r=t>>>3;t=r<<1;n=644+(t<<2)|0;e=de[151]|0;r=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{d=t;m=e}}else{de[151]=e|r;d=644+(t+2<<2)|0;m=n}de[d>>2]=o;de[m+12>>2]=o;de[o+8>>2]=m;de[o+12>>2]=n}de[153]=l;de[156]=s}F=i+8|0;return F|0}else m=p}else m=p}else if(e>>>0<=4294967231){e=e+11|0;c=e&-8;h=de[152]|0;if(h){r=0-c|0;e=e>>>8;if(e)if(c>>>0>16777215)u=31;else{m=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;u=14-(d|m|u)+(b<>>15)|0;u=c>>>(u+7|0)&1|u<<1}else u=0;e=de[908+(u<<2)>>2]|0;e:do{if(!e){n=0;e=0;b=86}else{a=r;n=0;s=c<<((u|0)==31?0:25-(u>>>1)|0);l=e;e=0;while(1){o=de[l+4>>2]&-8;r=o-c|0;if(r>>>0>>0)if((o|0)==(c|0)){o=l;e=l;b=90;break e}else e=l;else r=a;b=de[l+20>>2]|0;l=de[l+16+(s>>>31<<2)>>2]|0;n=(b|0)==0|(b|0)==(l|0)?n:b;if(!l){b=86;break}else{a=r;s=s<<1}}}}while(0);if((b|0)==86){if((n|0)==0&(e|0)==0){e=2<>>12&16;e=e>>>f;h=e>>>5&8;e=e>>>h;d=e>>>2&4;e=e>>>d;m=e>>>1&2;e=e>>>m;n=e>>>1&1;n=de[908+((h|f|d|m|n)+(e>>>n)<<2)>>2]|0;e=0}if(!n){s=r;l=e}else{o=n;b=90}}if((b|0)==90)while(1){b=0;m=(de[o+4>>2]&-8)-c|0;n=m>>>0>>0;r=n?m:r;e=n?o:e;n=de[o+16>>2]|0;if(n){o=n;b=90;continue}o=de[o+20>>2]|0;if(!o){s=r;l=e;break}else b=90}if((l|0)!=0?s>>>0<((de[153]|0)-c|0)>>>0:0){n=de[155]|0;if(l>>>0>>0)Xe();a=l+c|0;if(l>>>0>=a>>>0)Xe();o=de[l+24>>2]|0;r=de[l+12>>2]|0;do{if((r|0)==(l|0)){e=l+20|0;t=de[e>>2]|0;if(!t){e=l+16|0;t=de[e>>2]|0;if(!t){p=0;break}}while(1){r=t+20|0;i=de[r>>2]|0;if(i){t=i;e=r;continue}r=t+16|0;i=de[r>>2]|0;if(!i)break;else{t=i;e=r}}if(e>>>0>>0)Xe();else{de[e>>2]=0;p=t;break}}else{i=de[l+8>>2]|0;if(i>>>0>>0)Xe();t=i+12|0;if((de[t>>2]|0)!=(l|0))Xe();e=r+8|0;if((de[e>>2]|0)==(l|0)){de[t>>2]=r;de[e>>2]=i;p=r;break}else Xe()}}while(0);do{if(o){t=de[l+28>>2]|0;e=908+(t<<2)|0;if((l|0)==(de[e>>2]|0)){de[e>>2]=p;if(!p){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=o+16|0;if((de[t>>2]|0)==(l|0))de[t>>2]=p;else de[o+20>>2]=p;if(!p)break}e=de[155]|0;if(p>>>0>>0)Xe();de[p+24>>2]=o;t=de[l+16>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[p+16>>2]=t;de[t+24>>2]=p;break}}while(0);t=de[l+20>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[p+20>>2]=t;de[t+24>>2]=p;break}}}while(0);e:do{if(s>>>0>=16){de[l+4>>2]=c|3;de[l+(c|4)>>2]=s|1;de[l+(s+c)>>2]=s;t=s>>>3;if(s>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{v=t;_=e}}else{de[151]=r|t;v=644+(e+2<<2)|0;_=i}de[v>>2]=a;de[_+12>>2]=a;de[l+(c+8)>>2]=_;de[l+(c+12)>>2]=i;break}t=s>>>8;if(t)if(s>>>0>16777215)i=31;else{L=(t+1048320|0)>>>16&8;F=t<>>16&4;F=F<>>16&2;i=14-(z|L|i)+(F<>>15)|0;i=s>>>(i+7|0)&1|i<<1}else i=0;t=908+(i<<2)|0;de[l+(c+28)>>2]=i;de[l+(c+20)>>2]=0;de[l+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break}t=de[t>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(s|0)){i=s<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(s|0)){T=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[l+(c+24)>>2]=t;de[l+(c+12)>>2]=a;de[l+(c+8)>>2]=a;break e}}else T=t}while(0);t=T+8|0;e=de[t>>2]|0;F=de[155]|0;if(e>>>0>=F>>>0&T>>>0>=F>>>0){de[e+12>>2]=a;de[t>>2]=a;de[l+(c+8)>>2]=e;de[l+(c+12)>>2]=T;de[l+(c+24)>>2]=0;break}else Xe()}else{F=s+c|0;de[l+4>>2]=F|3;F=l+(F+4)|0;de[F>>2]=de[F>>2]|1}}while(0);F=l+8|0;return F|0}else m=c}else m=c}else m=-1}while(0);r=de[153]|0;if(r>>>0>=m>>>0){t=r-m|0;e=de[156]|0;if(t>>>0>15){de[156]=e+m;de[153]=t;de[e+(m+4)>>2]=t|1;de[e+r>>2]=t;de[e+4>>2]=m|3}else{de[153]=0;de[156]=0;de[e+4>>2]=r|3;F=e+(r+4)|0;de[F>>2]=de[F>>2]|1}F=e+8|0;return F|0}e=de[154]|0;if(e>>>0>m>>>0){L=e-m|0;de[154]=L;F=de[157]|0;de[157]=F+m;de[F+(m+4)>>2]=L|1;de[F+4>>2]=m|3;F=F+8|0;return F|0}do{if(!(de[269]|0)){e=De(30)|0;if(!(e+-1&e)){de[271]=e;de[270]=e;de[272]=-1;de[273]=-1;de[274]=0;de[262]=0;T=(Ge(0)|0)&-16^1431655768;de[269]=T;break}else Xe()}}while(0);l=m+48|0;s=de[271]|0;u=m+47|0;a=s+u|0;s=0-s|0;h=a&s;if(h>>>0<=m>>>0){F=0;return F|0}e=de[261]|0;if((e|0)!=0?(_=de[259]|0,T=_+h|0,T>>>0<=_>>>0|T>>>0>e>>>0):0){F=0;return F|0}e:do{if(!(de[262]&4)){e=de[157]|0;t:do{if(e){n=1052;while(1){r=de[n>>2]|0;if(r>>>0<=e>>>0?(g=n+4|0,(r+(de[g>>2]|0)|0)>>>0>e>>>0):0){o=n;e=g;break}n=de[n+8>>2]|0;if(!n){b=174;break t}}r=a-(de[154]|0)&s;if(r>>>0<2147483647){n=Ie(r|0)|0;T=(n|0)==((de[o>>2]|0)+(de[e>>2]|0)|0);e=T?r:0;if(T){if((n|0)!=(-1|0)){x=n;d=e;b=194;break e}}else b=184}else e=0}else b=174}while(0);do{if((b|0)==174){o=Ie(0)|0;if((o|0)!=(-1|0)){e=o;r=de[270]|0;n=r+-1|0;if(!(n&e))r=h;else r=h-e+(n+e&0-r)|0;e=de[259]|0;n=e+r|0;if(r>>>0>m>>>0&r>>>0<2147483647){T=de[261]|0;if((T|0)!=0?n>>>0<=e>>>0|n>>>0>T>>>0:0){e=0;break}n=Ie(r|0)|0;T=(n|0)==(o|0);e=T?r:0;if(T){x=o;d=e;b=194;break e}else b=184}else e=0}else e=0}}while(0);t:do{if((b|0)==184){o=0-r|0;do{if(l>>>0>r>>>0&(r>>>0<2147483647&(n|0)!=(-1|0))?(y=de[271]|0,y=u-r+y&0-y,y>>>0<2147483647):0)if((Ie(y|0)|0)==(-1|0)){Ie(o|0)|0;break t}else{r=y+r|0;break}}while(0);if((n|0)!=(-1|0)){x=n;d=r;b=194;break e}}}while(0);de[262]=de[262]|4;b=191}else{e=0;b=191}}while(0);if((((b|0)==191?h>>>0<2147483647:0)?(x=Ie(h|0)|0,w=Ie(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(w|0)!=(-1|0))):0)?(k=w-x|0,P=k>>>0>(m+40|0)>>>0,P):0){d=P?k:e;b=194}if((b|0)==194){e=(de[259]|0)+d|0;de[259]=e;if(e>>>0>(de[260]|0)>>>0)de[260]=e;a=de[157]|0;e:do{if(a){o=1052;do{e=de[o>>2]|0;r=o+4|0;n=de[r>>2]|0;if((x|0)==(e+n|0)){S=e;E=r;A=n;C=o;b=204;break}o=de[o+8>>2]|0}while((o|0)!=0);if(((b|0)==204?(de[C+12>>2]&8|0)==0:0)?a>>>0>>0&a>>>0>=S>>>0:0){de[E>>2]=A+d;F=(de[154]|0)+d|0;L=a+8|0;L=(L&7|0)==0?0:0-L&7;z=F-L|0;de[157]=a+L;de[154]=z;de[a+(L+4)>>2]=z|1;de[a+(F+4)>>2]=40;de[158]=de[273];break}e=de[155]|0;if(x>>>0>>0){de[155]=x;e=x}r=x+d|0;o=1052;while(1){if((de[o>>2]|0)==(r|0)){n=o;r=o;b=212;break}o=de[o+8>>2]|0;if(!o){r=1052;break}}if((b|0)==212)if(!(de[r+12>>2]&8)){de[n>>2]=x;f=r+4|0;de[f>>2]=(de[f>>2]|0)+d;f=x+8|0;f=(f&7|0)==0?0:0-f&7;u=x+(d+8)|0;u=(u&7|0)==0?0:0-u&7;t=x+(u+d)|0;c=f+m|0;p=x+c|0;h=t-(x+f)-m|0;de[x+(f+4)>>2]=m|3;t:do{if((t|0)!=(a|0)){if((t|0)==(de[156]|0)){F=(de[153]|0)+h|0;de[153]=F;de[156]=p;de[x+(c+4)>>2]=F|1;de[x+(F+c)>>2]=F;break}s=d+4|0;r=de[x+(s+u)>>2]|0;if((r&3|0)==1){l=r&-8;o=r>>>3;r:do{if(r>>>0>=256){a=de[x+((u|24)+d)>>2]|0;i=de[x+(d+12+u)>>2]|0;do{if((i|0)==(t|0)){n=u|16;i=x+(s+n)|0;r=de[i>>2]|0;if(!r){i=x+(n+d)|0;r=de[i>>2]|0;if(!r){R=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;R=r;break}}else{n=de[x+((u|8)+d)>>2]|0;if(n>>>0>>0)Xe();e=n+12|0;if((de[e>>2]|0)!=(t|0))Xe();r=i+8|0;if((de[r>>2]|0)==(t|0)){de[e>>2]=i;de[r>>2]=n;R=i;break}else Xe()}}while(0);if(!a)break;e=de[x+(d+28+u)>>2]|0;r=908+(e<<2)|0;do{if((t|0)!=(de[r>>2]|0)){if(a>>>0<(de[155]|0)>>>0)Xe();e=a+16|0;if((de[e>>2]|0)==(t|0))de[e>>2]=R;else de[a+20>>2]=R;if(!R)break r}else{de[r>>2]=R;if(R)break;de[152]=de[152]&~(1<>>0>>0)Xe();de[R+24>>2]=a;t=u|16;e=de[x+(t+d)>>2]|0;do{if(e)if(e>>>0>>0)Xe();else{de[R+16>>2]=e;de[e+24>>2]=R;break}}while(0);t=de[x+(s+t)>>2]|0;if(!t)break;if(t>>>0<(de[155]|0)>>>0)Xe();else{de[R+20>>2]=t;de[t+24>>2]=R;break}}else{i=de[x+((u|8)+d)>>2]|0;n=de[x+(d+12+u)>>2]|0;r=644+(o<<1<<2)|0;do{if((i|0)!=(r|0)){if(i>>>0>>0)Xe();if((de[i+12>>2]|0)==(t|0))break;Xe()}}while(0);if((n|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();e=n+8|0;if((de[e>>2]|0)==(t|0)){I=e;break}Xe()}}while(0);de[i+12>>2]=n;de[I>>2]=i}}while(0);t=x+((l|u)+d)|0;n=l+h|0}else n=h;t=t+4|0;de[t>>2]=de[t>>2]&-2;de[x+(c+4)>>2]=n|1;de[x+(n+c)>>2]=n;t=n>>>3;if(n>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0>=(de[155]|0)>>>0){z=t;L=e;break}Xe()}}while(0);de[z>>2]=p;de[L+12>>2]=p;de[x+(c+8)>>2]=L;de[x+(c+12)>>2]=i;break}t=n>>>8;do{if(!t)i=0;else{if(n>>>0>16777215){i=31;break}z=(t+1048320|0)>>>16&8;L=t<>>16&4;L=L<>>16&2;i=14-(R|z|i)+(L<>>15)|0;i=n>>>(i+7|0)&1|i<<1}}while(0);t=908+(i<<2)|0;de[x+(c+28)>>2]=i;de[x+(c+20)>>2]=0;de[x+(c+16)>>2]=0;e=de[152]|0;r=1<>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break}t=de[t>>2]|0;r:do{if((de[t+4>>2]&-8|0)!=(n|0)){i=n<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(n|0)){F=r;break r}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=p;de[x+(c+24)>>2]=t;de[x+(c+12)>>2]=p;de[x+(c+8)>>2]=p;break t}}else F=t}while(0);t=F+8|0;e=de[t>>2]|0;L=de[155]|0;if(e>>>0>=L>>>0&F>>>0>=L>>>0){de[e+12>>2]=p;de[t>>2]=p;de[x+(c+8)>>2]=e;de[x+(c+12)>>2]=F;de[x+(c+24)>>2]=0;break}else Xe()}else{F=(de[154]|0)+h|0;de[154]=F;de[157]=p;de[x+(c+4)>>2]=F|1}}while(0);F=x+(f|8)|0;return F|0}else r=1052;while(1){e=de[r>>2]|0;if(e>>>0<=a>>>0?(t=de[r+4>>2]|0,i=e+t|0,i>>>0>a>>>0):0)break;r=de[r+8>>2]|0}n=e+(t+-39)|0;e=e+(t+-47+((n&7|0)==0?0:0-n&7))|0;n=a+16|0;e=e>>>0>>0?a:e;t=e+8|0;r=x+8|0;r=(r&7|0)==0?0:0-r&7;F=d+-40-r|0;de[157]=x+r;de[154]=F;de[x+(r+4)>>2]=F|1;de[x+(d+-36)>>2]=40;de[158]=de[273];r=e+4|0;de[r>>2]=27;de[t>>2]=de[263];de[t+4>>2]=de[264];de[t+8>>2]=de[265];de[t+12>>2]=de[266];de[263]=x;de[264]=d;de[266]=0;de[265]=t;t=e+28|0;de[t>>2]=7;if((e+32|0)>>>0>>0)do{F=t;t=t+4|0;de[t>>2]=7}while((F+8|0)>>>0>>0);if((e|0)!=(a|0)){o=e-a|0;de[r>>2]=de[r>>2]&-2;de[a+4>>2]=o|1;de[e>>2]=o;t=o>>>3;if(o>>>0<256){e=t<<1;i=644+(e<<2)|0;r=de[151]|0;t=1<>2]|0;if(e>>>0<(de[155]|0)>>>0)Xe();else{O=t;M=e}}else{de[151]=r|t;O=644+(e+2<<2)|0;M=i}de[O>>2]=a;de[M+12>>2]=a;de[a+8>>2]=M;de[a+12>>2]=i;break}t=o>>>8;if(t)if(o>>>0>16777215)i=31;else{L=(t+1048320|0)>>>16&8;F=t<>>16&4;F=F<>>16&2;i=14-(z|L|i)+(F<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;r=908+(i<<2)|0;de[a+28>>2]=i;de[a+20>>2]=0;de[n>>2]=0;t=de[152]|0;e=1<>2]=a;de[a+24>>2]=r;de[a+12>>2]=a;de[a+8>>2]=a;break}t=de[r>>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){i=o<<((i|0)==31?0:25-(i>>>1)|0);while(1){e=t+16+(i>>>31<<2)|0;r=de[e>>2]|0;if(!r)break;if((de[r+4>>2]&-8|0)==(o|0)){D=r;break t}else{i=i<<1;t=r}}if(e>>>0<(de[155]|0)>>>0)Xe();else{de[e>>2]=a;de[a+24>>2]=t;de[a+12>>2]=a;de[a+8>>2]=a;break e}}else D=t}while(0);t=D+8|0;e=de[t>>2]|0;F=de[155]|0;if(e>>>0>=F>>>0&D>>>0>=F>>>0){de[e+12>>2]=a;de[t>>2]=a;de[a+8>>2]=e;de[a+12>>2]=D;de[a+24>>2]=0;break}else Xe()}}else{F=de[155]|0;if((F|0)==0|x>>>0>>0)de[155]=x;de[263]=x;de[264]=d;de[266]=0;de[160]=de[269];de[159]=-1;t=0;do{F=t<<1;L=644+(F<<2)|0;de[644+(F+3<<2)>>2]=L;de[644+(F+2<<2)>>2]=L;t=t+1|0}while((t|0)!=32);F=x+8|0;F=(F&7|0)==0?0:0-F&7;L=d+-40-F|0;de[157]=x+F;de[154]=L;de[x+(F+4)>>2]=L|1;de[x+(d+-36)>>2]=40;de[158]=de[273]}}while(0);t=de[154]|0;if(t>>>0>m>>>0){L=t-m|0;de[154]=L;F=de[157]|0;de[157]=F+m;de[F+(m+4)>>2]=L|1;de[F+4>>2]=m|3;F=F+8|0;return F|0}}F=hr()|0;de[F>>2]=12;F=0;return F|0}function Ur(e){e=e|0;var t=0,r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0,y=0;if(!e)return;t=e+-8|0;s=de[155]|0;if(t>>>0>>0)Xe();r=de[e+-4>>2]|0;i=r&3;if((i|0)==1)Xe();p=r&-8;m=e+(p+-8)|0;do{if(!(r&1)){t=de[t>>2]|0;if(!i)return;l=-8-t|0;h=e+l|0;c=t+p|0;if(h>>>0>>0)Xe();if((h|0)==(de[156]|0)){t=e+(p+-4)|0;r=de[t>>2]|0;if((r&3|0)!=3){y=h;o=c;break}de[153]=c;de[t>>2]=r&-2;de[e+(l+4)>>2]=c|1;de[m>>2]=c;return}n=t>>>3;if(t>>>0<256){i=de[e+(l+8)>>2]|0;r=de[e+(l+12)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0>>0)Xe();if((de[i+12>>2]|0)!=(h|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(h|0))a=t;else Xe()}else a=r+8|0;de[i+12>>2]=r;de[a>>2]=i;y=h;o=c;break}a=de[e+(l+24)>>2]|0;i=de[e+(l+12)>>2]|0;do{if((i|0)==(h|0)){r=e+(l+20)|0;t=de[r>>2]|0;if(!t){r=e+(l+16)|0;t=de[r>>2]|0;if(!t){u=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0>>0)Xe();else{de[r>>2]=0;u=t;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();t=n+12|0;if((de[t>>2]|0)!=(h|0))Xe();r=i+8|0;if((de[r>>2]|0)==(h|0)){de[t>>2]=i;de[r>>2]=n;u=i;break}else Xe()}}while(0);if(a){t=de[e+(l+28)>>2]|0;r=908+(t<<2)|0;if((h|0)==(de[r>>2]|0)){de[r>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(h|0))de[t>>2]=u;else de[a+20>>2]=u;if(!u){y=h;o=c;break}}r=de[155]|0;if(u>>>0>>0)Xe();de[u+24>>2]=a;t=de[e+(l+16)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[u+16>>2]=t;de[t+24>>2]=u;break}}while(0);t=de[e+(l+20)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[u+20>>2]=t;de[t+24>>2]=u;y=h;o=c;break}else{y=h;o=c}}else{y=h;o=c}}else{y=t;o=p}}while(0);if(y>>>0>=m>>>0)Xe();t=e+(p+-4)|0;r=de[t>>2]|0;if(!(r&1))Xe();if(!(r&2)){if((m|0)==(de[157]|0)){_=(de[154]|0)+o|0;de[154]=_;de[157]=y;de[y+4>>2]=_|1;if((y|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){_=(de[153]|0)+o|0;de[153]=_;de[156]=y;de[y+4>>2]=_|1;de[y+_>>2]=_;return}o=(r&-8)+o|0;n=r>>>3;do{if(r>>>0>=256){a=de[e+(p+16)>>2]|0;t=de[e+(p|4)>>2]|0;do{if((t|0)==(m|0)){r=e+(p+12)|0;t=de[r>>2]|0;if(!t){r=e+(p+8)|0;t=de[r>>2]|0;if(!t){d=0;break}}while(1){i=t+20|0;n=de[i>>2]|0;if(n){t=n;r=i;continue}i=t+16|0;n=de[i>>2]|0;if(!n)break;else{t=n;r=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=0;d=t;break}}else{r=de[e+p>>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();i=r+12|0;if((de[i>>2]|0)!=(m|0))Xe();n=t+8|0;if((de[n>>2]|0)==(m|0)){de[i>>2]=t;de[n>>2]=r;d=t;break}else Xe()}}while(0);if(a){t=de[e+(p+20)>>2]|0;r=908+(t<<2)|0;if((m|0)==(de[r>>2]|0)){de[r>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();t=a+16|0;if((de[t>>2]|0)==(m|0))de[t>>2]=d;else de[a+20>>2]=d;if(!d)break}r=de[155]|0;if(d>>>0>>0)Xe();de[d+24>>2]=a;t=de[e+(p+8)>>2]|0;do{if(t)if(t>>>0>>0)Xe();else{de[d+16>>2]=t;de[t+24>>2]=d;break}}while(0);t=de[e+(p+12)>>2]|0;if(t)if(t>>>0<(de[155]|0)>>>0)Xe();else{de[d+20>>2]=t;de[t+24>>2]=d;break}}}else{i=de[e+p>>2]|0;r=de[e+(p|4)>>2]|0;t=644+(n<<1<<2)|0;if((i|0)!=(t|0)){if(i>>>0<(de[155]|0)>>>0)Xe();if((de[i+12>>2]|0)!=(m|0))Xe()}if((r|0)==(i|0)){de[151]=de[151]&~(1<>>0<(de[155]|0)>>>0)Xe();t=r+8|0;if((de[t>>2]|0)==(m|0))f=t;else Xe()}else f=r+8|0;de[i+12>>2]=r;de[f>>2]=i}}while(0);de[y+4>>2]=o|1;de[y+o>>2]=o;if((y|0)==(de[156]|0)){de[153]=o;return}}else{de[t>>2]=r&-2;de[y+4>>2]=o|1;de[y+o>>2]=o}t=o>>>3;if(o>>>0<256){r=t<<1;n=644+(r<<2)|0;i=de[151]|0;t=1<>2]|0;if(r>>>0<(de[155]|0)>>>0)Xe();else{g=t;v=r}}else{de[151]=i|t;g=644+(r+2<<2)|0;v=n}de[g>>2]=y;de[v+12>>2]=y;de[y+8>>2]=v;de[y+12>>2]=n;return}t=o>>>8;if(t)if(o>>>0>16777215)n=31;else{g=(t+1048320|0)>>>16&8;v=t<>>16&4;v=v<>>16&2;n=14-(m|g|n)+(v<>>15)|0;n=o>>>(n+7|0)&1|n<<1}else n=0;t=908+(n<<2)|0;de[y+28>>2]=n;de[y+20>>2]=0;de[y+16>>2]=0;r=de[152]|0;i=1<>2]|0;t:do{if((de[t+4>>2]&-8|0)!=(o|0)){n=o<<((n|0)==31?0:25-(n>>>1)|0);while(1){r=t+16+(n>>>31<<2)|0;i=de[r>>2]|0;if(!i)break;if((de[i+4>>2]&-8|0)==(o|0)){_=i;break t}else{n=n<<1;t=i}}if(r>>>0<(de[155]|0)>>>0)Xe();else{de[r>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y;break e}}else _=t}while(0);t=_+8|0;r=de[t>>2]|0;v=de[155]|0;if(r>>>0>=v>>>0&_>>>0>=v>>>0){de[r+12>>2]=y;de[t>>2]=y;de[y+8>>2]=r;de[y+12>>2]=_;de[y+24>>2]=0;break}else Xe()}else{de[152]=r|i;de[t>>2]=y;de[y+24>>2]=t;de[y+12>>2]=y;de[y+8>>2]=y}}while(0);y=(de[159]|0)+-1|0;de[159]=y;if(!y)t=1060;else return;while(1){t=de[t>>2]|0;if(!t)break;else t=t+8|0}de[159]=-1;return}function Xr(e,t){e=e|0;t=t|0;var r=0,i=0;if(!e){e=Br(t)|0;return e|0}if(t>>>0>4294967231){e=hr()|0;de[e>>2]=12;e=0;return e|0}r=Gr(e+-8|0,t>>>0<11?16:t+11&-8)|0;if(r){e=r+8|0;return e|0}r=Br(t)|0;if(!r){e=0;return e|0}i=de[e+-4>>2]|0;i=(i&-8)-((i&3|0)==0?8:4)|0;Qr(r|0,e|0,(i>>>0>>0?i:t)|0)|0;Ur(e);e=r;return e|0}function Hr(e){e=e|0;var t=0;if(!e){t=0;return t|0}e=de[e+-4>>2]|0;t=e&3;if((t|0)==1){t=0;return t|0}t=(e&-8)-((t|0)==0?8:4)|0;return t|0}function Gr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;p=e+4|0;d=de[p>>2]|0;l=d&-8;h=e+l|0;s=de[155]|0;r=d&3;if(!((r|0)!=1&e>>>0>=s>>>0&e>>>0>>0))Xe();i=e+(l|4)|0;n=de[i>>2]|0;if(!(n&1))Xe();if(!r){if(t>>>0<256){e=0;return e|0}if(l>>>0>=(t+4|0)>>>0?(l-t|0)>>>0<=de[271]<<1>>>0:0)return e|0;e=0;return e|0}if(l>>>0>=t>>>0){r=l-t|0;if(r>>>0<=15)return e|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|3;de[i>>2]=de[i>>2]|1;Wr(e+t|0,r);return e|0}if((h|0)==(de[157]|0)){r=(de[154]|0)+l|0;if(r>>>0<=t>>>0){e=0;return e|0}f=r-t|0;de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|1;de[157]=e+t;de[154]=f;return e|0}if((h|0)==(de[156]|0)){i=(de[153]|0)+l|0;if(i>>>0>>0){e=0;return e|0}r=i-t|0;if(r>>>0>15){de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=r|1;de[e+i>>2]=r;i=e+(i+4)|0;de[i>>2]=de[i>>2]&-2;i=e+t|0}else{de[p>>2]=d&1|i|2;i=e+(i+4)|0;de[i>>2]=de[i>>2]|1;i=0;r=0}de[153]=r;de[156]=i;return e|0}if(n&2){e=0;return e|0}c=(n&-8)+l|0;if(c>>>0>>0){e=0;return e|0}f=c-t|0;o=n>>>3;do{if(n>>>0>=256){a=de[e+(l+24)>>2]|0;o=de[e+(l+12)>>2]|0;do{if((o|0)==(h|0)){i=e+(l+20)|0;r=de[i>>2]|0;if(!r){i=e+(l+16)|0;r=de[i>>2]|0;if(!r){u=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;u=r;break}}else{n=de[e+(l+8)>>2]|0;if(n>>>0>>0)Xe();r=n+12|0;if((de[r>>2]|0)!=(h|0))Xe();i=o+8|0;if((de[i>>2]|0)==(h|0)){de[r>>2]=o;de[i>>2]=n;u=o;break}else Xe()}}while(0);if(a){r=de[e+(l+28)>>2]|0;i=908+(r<<2)|0;if((h|0)==(de[i>>2]|0)){de[i>>2]=u;if(!u){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=a+16|0;if((de[r>>2]|0)==(h|0))de[r>>2]=u;else de[a+20>>2]=u;if(!u)break}i=de[155]|0;if(u>>>0>>0)Xe();de[u+24>>2]=a;r=de[e+(l+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{de[u+16>>2]=r;de[r+24>>2]=u;break}}while(0);r=de[e+(l+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[u+20>>2]=r;de[r+24>>2]=u;break}}}else{n=de[e+(l+8)>>2]|0;i=de[e+(l+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(h|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(h|0))a=r;else Xe()}else a=i+8|0;de[n+12>>2]=i;de[a>>2]=n}}while(0);if(f>>>0<16){de[p>>2]=c|d&1|2;t=e+(c|4)|0;de[t>>2]=de[t>>2]|1;return e|0}else{de[p>>2]=d&1|t|2;de[e+(t+4)>>2]=f|3;d=e+(c|4)|0;de[d>>2]=de[d>>2]|1;Wr(e+t|0,f);return e|0}return 0}function Wr(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0,m=0,g=0,v=0,_=0;m=e+t|0;r=de[e+4>>2]|0;do{if(!(r&1)){u=de[e>>2]|0;if(!(r&3))return;f=e+(0-u)|0;c=u+t|0;l=de[155]|0;if(f>>>0>>0)Xe();if((f|0)==(de[156]|0)){i=e+(t+4)|0;r=de[i>>2]|0;if((r&3|0)!=3){_=f;a=c;break}de[153]=c;de[i>>2]=r&-2;de[e+(4-u)>>2]=c|1;de[m>>2]=c;return}o=u>>>3;if(u>>>0<256){n=de[e+(8-u)>>2]|0;i=de[e+(12-u)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(f|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(f|0))s=r;else Xe()}else s=i+8|0;de[n+12>>2]=i;de[s>>2]=n;_=f;a=c;break}s=de[e+(24-u)>>2]|0;n=de[e+(12-u)>>2]|0;do{if((n|0)==(f|0)){n=16-u|0;i=e+(n+4)|0;r=de[i>>2]|0;if(!r){i=e+n|0;r=de[i>>2]|0;if(!r){h=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;h=r;break}}else{o=de[e+(8-u)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(f|0))Xe();i=n+8|0;if((de[i>>2]|0)==(f|0)){de[r>>2]=n;de[i>>2]=o;h=n;break}else Xe()}}while(0);if(s){r=de[e+(28-u)>>2]|0;i=908+(r<<2)|0;if((f|0)==(de[i>>2]|0)){de[i>>2]=h;if(!h){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=s+16|0;if((de[r>>2]|0)==(f|0))de[r>>2]=h;else de[s+20>>2]=h;if(!h){_=f;a=c;break}}n=de[155]|0;if(h>>>0>>0)Xe();de[h+24>>2]=s;r=16-u|0;i=de[e+r>>2]|0;do{if(i)if(i>>>0>>0)Xe();else{de[h+16>>2]=i;de[i+24>>2]=h;break}}while(0);r=de[e+(r+4)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[h+20>>2]=r;de[r+24>>2]=h;_=f;a=c;break}else{_=f;a=c}}else{_=f;a=c}}else{_=e;a=t}}while(0);l=de[155]|0;if(m>>>0>>0)Xe();r=e+(t+4)|0;i=de[r>>2]|0;if(!(i&2)){if((m|0)==(de[157]|0)){v=(de[154]|0)+a|0;de[154]=v;de[157]=_;de[_+4>>2]=v|1;if((_|0)!=(de[156]|0))return;de[156]=0;de[153]=0;return}if((m|0)==(de[156]|0)){v=(de[153]|0)+a|0;de[153]=v;de[156]=_;de[_+4>>2]=v|1;de[_+v>>2]=v;return}a=(i&-8)+a|0;o=i>>>3;do{if(i>>>0>=256){s=de[e+(t+24)>>2]|0;n=de[e+(t+12)>>2]|0;do{if((n|0)==(m|0)){i=e+(t+20)|0;r=de[i>>2]|0;if(!r){i=e+(t+16)|0;r=de[i>>2]|0;if(!r){d=0;break}}while(1){n=r+20|0;o=de[n>>2]|0;if(o){r=o;i=n;continue}n=r+16|0;o=de[n>>2]|0;if(!o)break;else{r=o;i=n}}if(i>>>0>>0)Xe();else{de[i>>2]=0;d=r;break}}else{o=de[e+(t+8)>>2]|0;if(o>>>0>>0)Xe();r=o+12|0;if((de[r>>2]|0)!=(m|0))Xe();i=n+8|0;if((de[i>>2]|0)==(m|0)){de[r>>2]=n;de[i>>2]=o;d=n;break}else Xe()}}while(0);if(s){r=de[e+(t+28)>>2]|0;i=908+(r<<2)|0;if((m|0)==(de[i>>2]|0)){de[i>>2]=d;if(!d){de[152]=de[152]&~(1<>>0<(de[155]|0)>>>0)Xe();r=s+16|0;if((de[r>>2]|0)==(m|0))de[r>>2]=d;else de[s+20>>2]=d;if(!d)break}i=de[155]|0;if(d>>>0>>0)Xe();de[d+24>>2]=s;r=de[e+(t+16)>>2]|0;do{if(r)if(r>>>0>>0)Xe();else{de[d+16>>2]=r;de[r+24>>2]=d;break}}while(0);r=de[e+(t+20)>>2]|0;if(r)if(r>>>0<(de[155]|0)>>>0)Xe();else{de[d+20>>2]=r;de[r+24>>2]=d;break}}}else{n=de[e+(t+8)>>2]|0;i=de[e+(t+12)>>2]|0;r=644+(o<<1<<2)|0;if((n|0)!=(r|0)){if(n>>>0>>0)Xe();if((de[n+12>>2]|0)!=(m|0))Xe()}if((i|0)==(n|0)){de[151]=de[151]&~(1<>>0>>0)Xe();r=i+8|0;if((de[r>>2]|0)==(m|0))p=r;else Xe()}else p=i+8|0;de[n+12>>2]=i;de[p>>2]=n}}while(0);de[_+4>>2]=a|1;de[_+a>>2]=a;if((_|0)==(de[156]|0)){de[153]=a;return}}else{de[r>>2]=i&-2;de[_+4>>2]=a|1;de[_+a>>2]=a}r=a>>>3;if(a>>>0<256){i=r<<1;o=644+(i<<2)|0;n=de[151]|0;r=1<>2]|0;if(i>>>0<(de[155]|0)>>>0)Xe();else{g=r;v=i}}else{de[151]=n|r;g=644+(i+2<<2)|0;v=o}de[g>>2]=_;de[v+12>>2]=_;de[_+8>>2]=v;de[_+12>>2]=o;return}r=a>>>8;if(r)if(a>>>0>16777215)o=31;else{g=(r+1048320|0)>>>16&8;v=r<>>16&4;v=v<>>16&2;o=14-(m|g|o)+(v<>>15)|0;o=a>>>(o+7|0)&1|o<<1}else o=0;r=908+(o<<2)|0;de[_+28>>2]=o;de[_+20>>2]=0;de[_+16>>2]=0;i=de[152]|0;n=1<>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}r=de[r>>2]|0;e:do{if((de[r+4>>2]&-8|0)!=(a|0)){o=a<<((o|0)==31?0:25-(o>>>1)|0);while(1){i=r+16+(o>>>31<<2)|0;n=de[i>>2]|0;if(!n)break;if((de[n+4>>2]&-8|0)==(a|0)){r=n;break e}else{o=o<<1;r=n}}if(i>>>0<(de[155]|0)>>>0)Xe();de[i>>2]=_;de[_+24>>2]=r;de[_+12>>2]=_;de[_+8>>2]=_;return}}while(0);i=r+8|0;n=de[i>>2]|0;v=de[155]|0;if(!(n>>>0>=v>>>0&r>>>0>=v>>>0))Xe();de[n+12>>2]=_;de[i>>2]=_;de[_+8>>2]=n;de[_+12>>2]=r;de[_+24>>2]=0;return}function qr(){}function Vr(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;i=t-i-(r>>>0>e>>>0|0)>>>0;return(re=i,e-r>>>0|0)|0}function Yr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0,n=0,o=0,a=0;i=e+r|0;if((r|0)>=20){t=t&255;o=e&3;a=t|t<<8|t<<16|t<<24;n=i&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){pe[e>>0]=t;e=e+1|0}}while((e|0)<(n|0)){de[e>>2]=a;e=e+4|0}}while((e|0)<(i|0)){pe[e>>0]=t;e=e+1|0}return e-r|0}function Zr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>>r;return e>>>r|(t&(1<>>r-32|0}function Jr(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t<>>32-r;return e<>>0;return(re=t+i+(r>>>0>>0|0)>>>0,r|0)|0}function Qr(e,t,r){e=e|0;t=t|0;r=r|0;var i=0;if((r|0)>=4096)return Me(e|0,t|0,r|0)|0;i=e|0;if((e&3)==(t&3)){while(e&3){if(!r)return i|0;pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}while((r|0)>=4){de[e>>2]=de[t>>2];e=e+4|0;t=t+4|0;r=r-4|0}}while((r|0)>0){pe[e>>0]=pe[t>>0]|0;e=e+1|0;t=t+1|0;r=r-1|0}return i|0}function $r(e,t,r){e=e|0;t=t|0;r=r|0;if((r|0)<32){re=t>>r;return e>>>r|(t&(1<>r-32|0}function ei(e){e=e|0;var t=0;t=pe[g+(e&255)>>0]|0;if((t|0)<8)return t|0;t=pe[g+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=pe[g+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(pe[g+(e>>>24)>>0]|0)+24|0}function ti(e,t){e=e|0;t=t|0;var r=0,i=0,n=0,o=0;o=e&65535;n=t&65535;r=_e(n,o)|0;i=e>>>16;e=(r>>>16)+(_e(n,i)|0)|0;n=t>>>16;t=_e(n,o)|0;return(re=(e>>>16)+(_e(n,i)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|r&65535|0)|0}function ri(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;u=t>>31|((t|0)<0?-1:0)<<1;l=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;o=i>>31|((i|0)<0?-1:0)<<1;n=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;s=Vr(u^e,l^t,u,l)|0;a=re;e=o^u;t=n^l;return Vr((si(s,a,Vr(o^r,n^i,o,n)|0,re,0)|0)^e,re^t,e,t)|0}function ii(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0,a=0,s=0,l=0,u=0;n=ve;ve=ve+16|0;s=n|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;u=i>>31|((i|0)<0?-1:0)<<1;l=((i|0)<0?-1:0)>>31|((i|0)<0?-1:0)<<1;e=Vr(a^e,o^t,a,o)|0;t=re;si(e,t,Vr(u^r,l^i,u,l)|0,re,s)|0;i=Vr(de[s>>2]^a,de[s+4>>2]^o,a,o)|0;r=re;ve=n;return(re=r,i)|0}function ni(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;n=e;o=r;r=ti(n,o)|0;e=re;return(re=(_e(t,o)|0)+(_e(i,n)|0)+e|e&0,r|0|0)|0}function oi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return si(e,t,r,i,0)|0}function ai(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;var n=0,o=0;o=ve;ve=ve+16|0;n=o|0;si(e,t,r,i,n)|0;ve=o;return(re=de[n+4>>2]|0,de[n>>2]|0)|0}function si(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;var o=0,a=0,s=0,l=0,u=0,h=0,c=0,f=0,p=0,d=0;h=e;l=t;u=l;a=r;f=i;s=f;if(!u){o=(n|0)!=0;if(!s){if(o){de[n>>2]=(h>>>0)%(a>>>0);de[n+4>>2]=0}f=0;n=(h>>>0)/(a>>>0)>>>0;return(re=f,n)|0}else{if(!o){f=0;n=0;return(re=f,n)|0}de[n>>2]=e|0;de[n+4>>2]=t&0;f=0;n=0;return(re=f,n)|0}}o=(s|0)==0;do{if(a){if(!o){o=(ae(s|0)|0)-(ae(u|0)|0)|0;if(o>>>0<=31){c=o+1|0;s=31-o|0;t=o-31>>31;a=c;e=h>>>(c>>>0)&t|u<>>(c>>>0)&t;o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;f=0;n=0;return(re=f,n)|0}o=a-1|0;if(o&a){s=(ae(a|0)|0)+33-(ae(u|0)|0)|0;d=64-s|0;c=32-s|0;l=c>>31;p=s-32|0;t=p>>31;a=s;e=c-1>>31&u>>>(p>>>0)|(u<>>(s>>>0))&t;t=t&u>>>(s>>>0);o=h<>>(p>>>0))&l|h<>31;break}if(n){de[n>>2]=o&h;de[n+4>>2]=0}if((a|0)==1){p=l|t&0;d=e|0|0;return(re=p,d)|0}else{d=ei(a|0)|0;p=u>>>(d>>>0)|0;d=u<<32-d|h>>>(d>>>0)|0;return(re=p,d)|0}}else{if(o){if(n){de[n>>2]=(u>>>0)%(a>>>0);de[n+4>>2]=0}p=0;d=(u>>>0)/(a>>>0)>>>0;return(re=p,d)|0}if(!h){if(n){de[n>>2]=0;de[n+4>>2]=(u>>>0)%(s>>>0)}p=0;d=(u>>>0)/(s>>>0)>>>0;return(re=p,d)|0}o=s-1|0;if(!(o&s)){if(n){de[n>>2]=e|0;de[n+4>>2]=o&u|t&0}p=0;d=u>>>((ei(s|0)|0)>>>0);return(re=p,d)|0}o=(ae(s|0)|0)-(ae(u|0)|0)|0;if(o>>>0<=30){t=o+1|0;s=31-o|0;a=t;e=u<>>(t>>>0);t=u>>>(t>>>0);o=0;s=h<>2]=e|0;de[n+4>>2]=l|t&0;p=0;d=0;return(re=p,d)|0}}while(0);if(!a){u=s;l=0;s=0}else{c=r|0|0;h=f|i&0;u=Kr(c|0,h|0,-1,-1)|0;r=re;l=s;s=0;do{i=l;l=o>>>31|l<<1;o=s|o<<1;i=e<<1|i>>>31|0;f=e>>>31|t<<1|0;Vr(u,r,i,f)|0;d=re;p=d>>31|((d|0)<0?-1:0)<<1;s=p&1;e=Vr(i,f,p&c,(((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1)&h)|0;t=re;a=a-1|0}while((a|0)!=0);u=l;l=0}a=0;if(n){de[n>>2]=e;de[n+4>>2]=t}p=(o|0)>>>31|(u|a)<<1|(a<<1|o>>>31)&0|l;d=(o<<1|0>>>31)&-2|s;return(re=p,d)|0}function li(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;return Si[e&7](t|0,r|0,i|0)|0}function ui(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;Ei[e&3](t|0,r|0,i|0,n|0,o|0)}function hi(e,t){e=e|0;t=t|0;Ai[e&7](t|0)}function ci(e,t){e=e|0;t=t|0;return Ci[e&1](t|0)|0}function fi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;Ii[e&0](t|0,r|0,i|0)}function pi(e){e=e|0;Oi[e&3]()}function di(e,t,r,i,n,o,a){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;a=a|0;Mi[e&3](t|0,r|0,i|0,n|0,o|0,a|0)}function mi(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;return Di[e&1](t|0,r|0,i|0,n|0,o|0)|0}function gi(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;Ri[e&3](t|0,r|0,i|0,n|0)}function vi(e,t,r){e=e|0;t=t|0;r=r|0;se(0);return 0}function _i(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(1)}function yi(e){e=e|0;se(2)}function bi(e){e=e|0;se(3);return 0}function xi(e,t,r){e=e|0;t=t|0;r=r|0;se(4)}function wi(){se(5)}function Ti(e,t,r,i,n,o){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;o=o|0;se(6)}function ki(e,t,r,i,n){e=e|0;t=t|0;r=r|0;i=i|0;n=n|0;se(7);return 0}function Pi(e,t,r,i){e=e|0;t=t|0;r=r|0;i=i|0;se(8)}var Si=[vi,Yt,Lr,Cr,Ar,Ir,vi,vi];var Ei=[_i,tr,er,_i];var Ai=[yi,Ht,qt,Gt,Wt,Vt,lr,zr];var Ci=[bi,Er];var Ii=[xi];var Oi=[wi,ar,sr,wi];var Mi=[Ti,ir,rr,Ti];var Di=[ki,lt];var Ri=[Pi,Jt,Kt,Pi];return{___cxa_can_catch:nr,_crn_get_levels:Tt,_crn_get_uncompressed_size:Pt,_crn_decompress:St,_i64Add:Kr,_crn_get_width:xt,___cxa_is_pointer_type:or,_i64Subtract:Vr,_memset:Yr,_malloc:Br,_free:Ur,_memcpy:Qr,_bitshift64Lshr:Zr,_fflush:gr,_bitshift64Shl:Jr,_crn_get_height:wt,___errno_location:hr,_crn_get_dxt_format:kt,runPostSets:qr,_emscripten_replace_memory:Ye,stackAlloc:Ze,stackSave:Je,stackRestore:Ke,establishStackSpace:Qe,setThrew:$e,setTempRet0:rt,getTempRet0:it,dynCall_iiii:li,dynCall_viiiii:ui,dynCall_vi:hi,dynCall_ii:ci,dynCall_viii:fi,dynCall_v:pi,dynCall_viiiiii:di,dynCall_iiiiii:mi,dynCall_viiii:gi}}(e.Ya,e.Za,buffer);e.___cxa_can_catch=Z.___cxa_can_catch,e._crn_get_levels=Z._crn_get_levels,e.runPostSets=Z.runPostSets,e._crn_get_uncompressed_size=Z._crn_get_uncompressed_size,e._crn_decompress=Z._crn_decompress;var zc=e._i64Add=Z._i64Add;e._crn_get_height=Z._crn_get_height,e.___cxa_is_pointer_type=Z.___cxa_is_pointer_type;var nb=e._i64Subtract=Z._i64Subtract,qb=e._memset=Z._memset,Ea=e._malloc=Z._malloc,Bc=e._memcpy=Z._memcpy,Xa=e._emscripten_replace_memory=Z._emscripten_replace_memory;e._crn_get_dxt_format=Z._crn_get_dxt_format;var rb=e._bitshift64Lshr=Z._bitshift64Lshr,Na=e._free=Z._free;e._fflush=Z._fflush,e._crn_get_width=Z._crn_get_width,e.___errno_location=Z.___errno_location;var sb=e._bitshift64Shl=Z._bitshift64Shl;function ia(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}e.dynCall_iiii=Z.dynCall_iiii,e.dynCall_viiiii=Z.dynCall_viiiii,e.dynCall_vi=Z.dynCall_vi,e.dynCall_ii=Z.dynCall_ii,e.dynCall_viii=Z.dynCall_viii,e.dynCall_v=Z.dynCall_v,e.dynCall_viiiiii=Z.dynCall_viiiiii,e.dynCall_iiiiii=Z.dynCall_iiiiii,e.dynCall_viiii=Z.dynCall_viiii,n.aa=Z.stackAlloc,n.ua=Z.stackSave,n.ba=Z.stackRestore,n.Cd=Z.establishStackSpace,n.rb=Z.setTempRet0,n.fb=Z.getTempRet0,ia.prototype=Error(),ia.prototype.constructor=ia;var rd=null,jb=function t(){e.calledRun||td(),e.calledRun||(jb=t)};function td(t){function r(){if(!e.calledRun&&(e.calledRun=!0,!na)){if(Ha||(Ha=!0,ab(cb)),ab(db),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e._main&&vd&&e.callMain(t),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)gb(e.postRun.shift());ab(eb)}}if(t=t||e.arguments,null===rd&&(rd=Date.now()),!(0>8&255,e>>16&255,e>>24&255)}!function(s){s.loadFromArrayBuffer=function(e,t,r){return new i(t).loadFromArrayBuffer(e,r)};var i=function(l){function e(e,t,r,i,n,o,a){var s=l.call(this)||this;return s.complete=!1,s.isCompressedImage=!0,s.preserveSource=!0,s.onload=null,s.baseTexture=null,s.init(e,t,r,i,n,o,a),s}return __extends(e,l),e.prototype.init=function(e,t,r,i,n,o,a){void 0===i&&(i=-1),void 0===n&&(n=-1),this.src=e,this.resize(i,n),this._width=i,this._height=n,this.data=t,this.type=r,this.levels=o,this.internalFormat=a;var s=this.complete;return this.complete=!!t,!s&&this.complete&&this.onload&&this.onload({target:this}),this.update(),this},e.prototype.dispose=function(){this.data=null},e.prototype.bind=function(e){void 0!==e.alphaMode?e.alphaMode=PIXI.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA:e.premultiplyAlpha=!1,l.prototype.bind.call(this,e)},e.prototype.upload=function(e,t,r){var i=e.state.gl;if(r.compressed=!1,e.texture.initCompressed(),null===this.data)throw"Trying to create a second (or more) webgl texture from the same CompressedImage : "+this.src;for(var n=this.levels,o=this.width,a=this.height,s=0,l=0;l>=1)<1&&(o=1),(a>>=1)<1&&(a=1),s+=u}return this._internalLoader.free(),this.preserveSource||(this.data=null),!0},e.prototype.style=function(e,t,r){var i=e.state.gl,n=this.levels;return t.scaleMode===PIXI.SCALE_MODES.LINEAR?1>2)*(t+3>>2)*8;case 33778:case 33779:case 35987:case 34798:return(e+3>>2)*(t+3>>2)*16;default:return 0}},h.type="DDS",h}(e.AbstractInternalLoader);e.DDSLoader=l}(pixi_compressed_textures||(pixi_compressed_textures={})),function(e){var t,c=((t={})[0]=35841,t[1]=35843,t[2]=35840,t[3]=35842,t[6]=36196,t[7]=33776,t[9]=33778,t[5]=33779,t),r=function(t){function h(e){return t.call(this,e)||this}return __extends(h,t),h.prototype.load=function(e){if(!h.test(e))throw"Invalid magic number in PVR header";var t=new Int32Array(e,0,13),r=t[2],i=c[r]||-1,n=t[7],o=t[6],a=t[11],s=t[12]+52,l=new Uint8Array(e,s),u=this._image;return this._format=i,u.init(u.src,l,"PVR",n,o,a,i),u},h.test=function(e){return 55727696===new Int32Array(e,0,1)[0]},h.prototype.levelBufferSize=function(e,t,r){switch(void 0===r&&(r=0),this._format){case 33776:case 36196:return(e+3>>2)*(t+3>>2)*8;case 33778:case 33779:return(e+3>>2)*(t+3>>2)*16;case 35840:case 35842:return Math.floor((Math.max(e,8)*Math.max(t,8)*4+7)/8);case 35841:case 35843:return Math.floor((Math.max(e,16)*Math.max(t,8)*2+7)/8);default:return 0}},h.type="PVR",h}(e.AbstractInternalLoader);e.PVRTCLoader=r}(pixi_compressed_textures||(pixi_compressed_textures={})),function(l){var e,t,r=0,i=2,n=3,o=8,a=9,s=10,u=11,c=((e={})[3]=!0,e[9]=!0,e[10]=!0,e[11]=!0,e),h=((t={})[u]=-1,t[r]=36196,t[i]=33776,t[n]=33779,t[o]=35840,t[a]=35842,t[s]=37808,t),f=Object.keys(h).reduce(function(e,t){return e[h[+t]]=+t,e},{}),p=function(r){function h(e){var t=r.call(this,e)||this;return t.type="BASIS",t._file=void 0,t}return __extends(h,r),h.test=function(e){var t=1262195===new Uint32Array(e,0,1)[0]&&!!h.BASIS_BINDING,r=h.RGB_FORMAT&&h.RGBA_FORMAT;return!t&&r&&console.warn("[BASIS LOADER] Is Supported, but transcoder not binded or file is not BASIS file!"),r&&t},h.bindTranscoder=function(e,i){if(!e||!i)throw"Invalid state! undef fileCtr or ext invalid!";var t=Object.keys(i).reduce(function(e,t){var r=i[t];return r?Object.assign(e,r.__proto__):e},{}),r=void 0,n=void 0;for(var o in t){var a=t[o];if(void 0!==f[a]){var s=f[a];c[s]?n={native:a,name:o,basis:s}:r={native:a,name:o,basis:s}}}h.RGB_FORMAT=r||n,h.RGBA_FORMAT=n||r,h.BASIS_BINDING=e,console.log("[BASISLoader] Supported formats:","\nRGB:"+h.RGB_FORMAT.name+"\nRGBA:"+h.RGBA_FORMAT.name),l.RegisterCompressedLoader(h),l.RegisterCompressedExtensions("basis")},h.prototype.load=function(e){if(!h.test(e))throw"BASIS Transcoder not binded or transcoding not supported =(!";return this._loadAsync(e),this._image},h.prototype._loadAsync=function(e){var t=performance.now(),r=new h.BASIS_BINDING(new Uint8Array(e)),i=r.getImageWidth(0,0),n=r.getImageHeight(0,0),o=r.getHasAlpha(),a=this._image;if(!r.startTranscoding())throw"Transcoding error!";var s=o?h.RGBA_FORMAT:h.RGB_FORMAT;console.log("Grats! BASIS will be transcoded to:",s);var l=new Uint8Array(r.getImageTranscodedSizeInBytes(0,0,s.basis));if(!r.transcodeImage(l,0,0,s.basis,!1,!1))throw"Transcoding error!";console.log("[BASISLoader] Totla transcoding time:",performance.now()-t),this._format=s.native,this._file=r;var u=s.name.replace("COMPRESSED_","");return Promise.resolve(a.init(a.src,l,"BASIS|"+u,i,n,1,s.native))},h.prototype.levelBufferSize=function(e,t,r){return this._file?this._file.getImageTranscodedSizeInBytes(0,r,f[this._format]):void 0},h.BASIS_BINDING=void 0,h}(l.AbstractInternalLoader);l.BASISLoader=p}(pixi_compressed_textures||(pixi_compressed_textures={})),function(i){var p=window.CRN_Module;var d=[33776,33778,33779],e=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.load=function(e){var t=e.byteLength,r=new Uint8Array(e),i=p._malloc(t);!function(e,t,r,i){for(var n=r/4,o=i%4,a=new Uint32Array(e.buffer,0,(i-o)/4),s=new Uint32Array(t.buffer),l=0;li.count)){var e=new a;return i.workers.push(e),e.init(t,r).then(function(){r=e.binary,o()})}};return o().then(function(){return i})},e.prototype.transcode=function(t,r){if(!this.workers||!this.workers.length)throw"[TranscoderWorkerPool] Pool empty, populate before!";var n=this.workers,o=void 0,a=0,s=function(e){for(var t=0,r=n;t 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n"),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},e)}return t&&(e.__proto__=t),((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,e.applyFilter(this,t,r,i)},e}(n.Filter),d=function(i){function e(e,t,r){void 0===e&&(e=4),void 0===t&&(t=3),void 0===r&&(r=!1),i.call(this,"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}",r?"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n":"\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}"),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new f.Point,this.pixelSize=1,this._clamp=r,this._kernels=null,Array.isArray(e)?this.kernels=e:(this._blur=e,this.quality=t)}i&&(e.__proto__=i);var t={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n,o=this.pixelSize.x/t._frame.width,a=this.pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)n=this._kernels[0]+.5,this.uniforms.uOffset[0]=n*o,this.uniforms.uOffset[1]=n*a,e.applyFilter(this,t,r,i);else{for(var s,l=e.getFilterTexture(),u=t,h=l,c=this._quality-1,f=0;f threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n"),this.threshold=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(e.prototype,r),e}(n.Filter),i=function(a){function e(e){a.call(this,c,"uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n"),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:p.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._extractFilter=new m(e.threshold),this._extractFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o}a&&(e.__proto__=a);var t={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r,i,n){var o=e.getFilterTexture();this._extractFilter.apply(e,t,o,!0,n);var a=e.getFilterTexture();this._blurFilter.apply(e,o,a,!0,n),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=a,e.applyFilter(this,t,r,i),e.returnFilterTexture(a),e.returnFilterTexture(o)},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.threshold.get=function(){return this._extractFilter.threshold},t.threshold.set=function(e){this._extractFilter.threshold=e},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),o=function(t){function e(e){void 0===e&&(e=8),t.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.pixelSize},r.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(e.prototype,r),e}(n.Filter),a=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),e=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},e),this.rotation=e.rotation,this.thickness=e.thickness,this.lightColor=e.lightColor,this.lightAlpha=e.lightAlpha,this.shadowColor=e.shadowColor,this.shadowAlpha=e.shadowAlpha}t&&(e.__proto__=t);var r={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},r.rotation.get=function(){return this._angle/f.DEG_TO_RAD},r.rotation.set=function(e){this._angle=e*f.DEG_TO_RAD,this._updateTransform()},r.thickness.get=function(){return this._thickness},r.thickness.set=function(e){this._thickness=e,this._updateTransform()},r.lightColor.get=function(){return l.rgb2hex(this.uniforms.lightColor)},r.lightColor.set=function(e){l.hex2rgb(e,this.uniforms.lightColor)},r.lightAlpha.get=function(){return this.uniforms.lightAlpha},r.lightAlpha.set=function(e){this.uniforms.lightAlpha=e},r.shadowColor.get=function(){return l.rgb2hex(this.uniforms.shadowColor)},r.shadowColor.set=function(e){l.hex2rgb(e,this.uniforms.shadowColor)},r.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},r.shadowAlpha.set=function(e){this.uniforms.shadowAlpha=e},Object.defineProperties(e.prototype,r),e}(n.Filter),g=function(a){function e(e,t,r,i){var n,o;void 0===e&&(e=2),void 0===t&&(t=4),void 0===r&&(r=p.settings.RESOLUTION),void 0===i&&(i=5),a.call(this),"number"==typeof e?o=n=e:e instanceof f.Point?(n=e.x,o=e.y):Array.isArray(e)&&(n=e[0],o=e[1]),this.blurXFilter=new h.BlurFilterPass(!0,n,t,r,i),this.blurYFilter=new h.BlurFilterPass(!1,o,t,r,i),this.blurYFilter.blendMode=s.BLEND_MODES.SCREEN,this.defaultFilter=new u.AlphaFilter}a&&(e.__proto__=a);var t={blur:{configurable:!0},blurX:{configurable:!0},blurY:{configurable:!0}};return((e.prototype=Object.create(a&&a.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture(!0);this.defaultFilter.apply(e,t,r),this.blurXFilter.apply(e,t,i),this.blurYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.blurXFilter.blur},t.blur.set=function(e){this.blurXFilter.blur=this.blurYFilter.blur=e},t.blurX.get=function(){return this.blurXFilter.blur},t.blurX.set=function(e){this.blurXFilter.blur=e},t.blurY.get=function(){return this.blurYFilter.blur},t.blurY.set=function(e){this.blurYFilter.blur=e},Object.defineProperties(e.prototype,t),e}(n.Filter),v=function(i){function e(e,t,r){i.call(this,"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}","uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.center=e||[.5,.5],this.radius="number"==typeof t?t:100,this.strength="number"==typeof r?r:1}i&&(e.__proto__=i);var t={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.strength.get=function(){return this.uniforms.strength},t.strength.set=function(e){this.uniforms.strength=e},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},Object.defineProperties(e.prototype,t),e}(n.Filter),_=function(i){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=1),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}"),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=r,this.colorMap=e}i&&(e.__proto__=i);var t={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms._mix=this.mix,e.applyFilter(this,t,r,i)},t.colorSize.get=function(){return this._size},t.colorMap.get=function(){return this._colorMap},t.colorMap.set=function(e){e instanceof n.Texture||(e=n.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},t.nearest.get=function(){return this._nearest},t.nearest.set=function(e){this._nearest=e,this._scaleMode=e?s.SCALE_MODES.NEAREST:s.SCALE_MODES.LINEAR;var t=this._colorMap;t&&t.baseTexture&&(t.baseTexture._glTextures={},t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=!1,t._updateID++,t.baseTexture.emit("update",t.baseTexture))},e.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},e.prototype.destroy=function(e){this._colorMap&&this._colorMap.destroy(e),i.prototype.destroy.call(this)},Object.defineProperties(e.prototype,t),e}(n.Filter),y=function(i){function e(e,t,r){void 0===e&&(e=16711680),void 0===t&&(t=0),void 0===r&&(r=.4),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n"),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=e,this.newColor=t,this.epsilon=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(e){var t=this.uniforms.originalColor;"number"==typeof e?(l.hex2rgb(e,t),this._originalColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._originalColor=l.rgb2hex(t))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(e){var t=this.uniforms.newColor;"number"==typeof e?(l.hex2rgb(e,t),this._newColor=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],this._newColor=l.rgb2hex(t))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(e){this.uniforms.epsilon=e},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(e.prototype,t),e}(n.Filter),b=function(i){function e(e,t,r){void 0===t&&(t=200),void 0===r&&(r=200),i.call(this,"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}","precision mediump float;\n\nvarying mediump vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec2 texelSize;\nuniform float matrix[9];\n\nvoid main(void)\n{\n vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left\n vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center\n vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right\n\n vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left\n vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center\n vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right\n\n vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left\n vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center\n vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right\n\n gl_FragColor =\n c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] +\n c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] +\n c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8];\n\n gl_FragColor.a = c22.a;\n}\n"),this.uniforms.texelSize=new Float32Array(2),this.uniforms.matrix=new Float32Array(9),void 0!==e&&(this.matrix=e),this.width=t,this.height=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={matrix:{configurable:!0},width:{configurable:!0},height:{configurable:!0}};return t.matrix.get=function(){return this.uniforms.matrix},t.matrix.set=function(e){var r=this;e.forEach(function(e,t){return r.uniforms.matrix[t]=e})},t.width.get=function(){return 1/this.uniforms.texelSize[0]},t.width.set=function(e){this.uniforms.texelSize[0]=1/e},t.height.get=function(){return 1/this.uniforms.texelSize[1]},t.height.set=function(e){this.uniforms.texelSize[1]=1/e},Object.defineProperties(e.prototype,t),e}(n.Filter),x=function(e){function t(){e.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb);\n\n gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);\n\n if (lum < 1.00)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.75)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.50)\n {\n if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n\n if (lum < 0.3)\n {\n if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n }\n }\n}\n")}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(n.Filter),w=function(t){function e(e){t.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e)}t&&(e.__proto__=t);var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.curvature.set=function(e){this.uniforms.curvature=e},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(e){this.uniforms.lineWidth=e},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(e){this.uniforms.lineContrast=e},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(e){this.uniforms.verticalLine=e},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(e){this.uniforms.noise=e},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(e){this.uniforms.noiseSize=e},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(e){this.uniforms.vignetting=e},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,r),e}(n.Filter),T=function(r){function e(e,t){void 0===e&&(e=1),void 0===t&&(t=5),r.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n"),this.scale=e,this.angle=t}r&&(e.__proto__=r),(e.prototype=Object.create(r&&r.prototype)).constructor=e;var t={scale:{configurable:!0},angle:{configurable:!0}};return t.scale.get=function(){return this.uniforms.scale},t.scale.set=function(e){this.uniforms.scale=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),k=function(c){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:p.settings.RESOLUTION},e),c.call(this);var t=e.kernels,r=e.blur,i=e.quality,n=e.pixelSize,o=e.resolution;this._tintFilter=new c("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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}"),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new f.Point,this._tintFilter.resolution=o,this._blurFilter=t?new d(t):new d(r,i),this.pixelSize=n,this.resolution=o;var a=e.shadowOnly,s=e.rotation,l=e.distance,u=e.alpha,h=e.color;this.shadowOnly=a,this.rotation=s,this.distance=l,this.alpha=u,this.color=h,this._updatePadding()}c&&(e.__proto__=c);var t={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return((e.prototype=Object.create(c&&c.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=e.getFilterTexture();this._tintFilter.apply(e,t,n,!0),this._blurFilter.apply(e,n,r,i),!0!==this.shadowOnly&&e.applyFilter(this,t,r,!1),e.returnFilterTexture(n)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},t.resolution.get=function(){return this._resolution},t.resolution.set=function(e){this._resolution=e,this._tintFilter&&(this._tintFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},t.distance.get=function(){return this._distance},t.distance.set=function(e){this._distance=e,this._updatePadding(),this._updateShift()},t.rotation.get=function(){return this.angle/f.DEG_TO_RAD},t.rotation.set=function(e){this.angle=e*f.DEG_TO_RAD,this._updateShift()},t.alpha.get=function(){return this._tintFilter.uniforms.alpha},t.alpha.set=function(e){this._tintFilter.uniforms.alpha=e},t.color.get=function(){return l.rgb2hex(this._tintFilter.uniforms.color)},t.color.set=function(e){l.hex2rgb(e,this._tintFilter.uniforms.color)},t.kernels.get=function(){return this._blurFilter.kernels},t.kernels.set=function(e){this._blurFilter.kernels=e},t.blur.get=function(){return this._blurFilter.blur},t.blur.set=function(e){this._blurFilter.blur=e,this._updatePadding()},t.quality.get=function(){return this._blurFilter.quality},t.quality.set=function(e){this._blurFilter.quality=e},t.pixelSize.get=function(){return this._blurFilter.pixelSize},t.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(e.prototype,t),e}(n.Filter),P=function(t){function e(e){void 0===e&&(e=5),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float strength;\nuniform vec4 filterArea;\n\n\nvoid main(void)\n{\n\tvec2 onePixel = vec2(1.0 / filterArea);\n\n\tvec4 color;\n\n\tcolor.rgb = vec3(0.5);\n\n\tcolor -= texture2D(uSampler, vTextureCoord - onePixel) * strength;\n\tcolor += texture2D(uSampler, vTextureCoord + onePixel) * strength;\n\n\tcolor.rgb = vec3((color.r + color.g + color.b) / 3.0);\n\n\tfloat alpha = texture2D(uSampler, vTextureCoord).a;\n\n\tgl_FragColor = vec4(color.rgb * alpha, alpha);\n}\n"),this.strength=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={strength:{configurable:!0}};return r.strength.get=function(){return this.uniforms.strength},r.strength.set=function(e){this.uniforms.strength=e},Object.defineProperties(e.prototype,r),e}(n.Filter),S=function(t){function e(e){void 0===e&&(e={}),t.call(this,"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}","// precision highp float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\nuniform float aspect;\n\nuniform sampler2D displacementMap;\nuniform float offset;\nuniform float sinDir;\nuniform float cosDir;\nuniform int fillMode;\n\nuniform float seed;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nconst int TRANSPARENT = 0;\nconst int ORIGINAL = 1;\nconst int LOOP = 2;\nconst int CLAMP = 3;\nconst int MIRROR = 4;\n\nvoid main(void)\n{\n vec2 coord = (vTextureCoord * filterArea.xy) / dimensions;\n\n if (coord.x > 1.0 || coord.y > 1.0) {\n return;\n }\n\n float cx = coord.x - 0.5;\n float cy = (coord.y - 0.5) * aspect;\n float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;\n\n // displacementMap: repeat\n // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n\n // displacementMap: mirror\n ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n\n vec4 dc = texture2D(displacementMap, vec2(0.5, ny));\n\n float displacement = (dc.r - dc.g) * (offset / filterArea.x);\n\n coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect);\n\n if (fillMode == CLAMP) {\n coord = clamp(coord, filterClamp.xy, filterClamp.zw);\n } else {\n if( coord.x > filterClamp.z ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x -= filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x = filterClamp.z * 2.0 - coord.x;\n }\n } else if( coord.x < filterClamp.x ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.x += filterClamp.z;\n } else if (fillMode == MIRROR) {\n coord.x *= -filterClamp.z;\n }\n }\n\n if( coord.y > filterClamp.w ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y -= filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y = filterClamp.w * 2.0 - coord.y;\n }\n } else if( coord.y < filterClamp.y ) {\n if (fillMode == TRANSPARENT) {\n discard;\n } else if (fillMode == LOOP) {\n coord.y += filterClamp.w;\n } else if (fillMode == MIRROR) {\n coord.y *= -filterClamp.w;\n }\n }\n }\n\n gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, coord).a;\n}\n"),this.uniforms.dimensions=new Float32Array(2),e=Object.assign({slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:[0,0],green:[0,0],blue:[0,0],minSize:8,sampleSize:512},e),this.direction=e.direction,this.red=e.red,this.green=e.green,this.blue=e.blue,this.offset=e.offset,this.fillMode=e.fillMode,this.average=e.average,this.seed=e.seed,this.minSize=e.minSize,this.sampleSize=e.sampleSize,this._canvas=document.createElement("canvas"),this._canvas.width=4,this._canvas.height=this.sampleSize,this.texture=n.Texture.from(this._canvas,{scaleMode:s.SCALE_MODES.NEAREST}),this._slices=0,this.slices=e.slices}t&&(e.__proto__=t);var r={sizes:{configurable:!0},offsets:{configurable:!0},slices:{configurable:!0},direction:{configurable:!0},red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){var n=t.filterFrame.width,o=t.filterFrame.height;this.uniforms.dimensions[0]=n,this.uniforms.dimensions[1]=o,this.uniforms.aspect=o/n,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,e.applyFilter(this,t,r,i)},e.prototype._randomizeSizes=function(){var e=this._sizes,t=this._slices-1,r=this.sampleSize,i=Math.min(this.minSize/r,.9/this._slices);if(this.average){for(var n=this._slices,o=1,a=0;a>0,i=e[t];e[t]=e[r],e[r]=i}},e.prototype._randomizeOffsets=function(){for(var e=0;e>0,t,1+a>>0),n+=a}r.baseTexture.update(),this.uniforms.displacementMap=r},r.sizes.set=function(e){for(var t=Math.min(this._slices,e.length),r=0;rthis._maxColors)throw"Length of replacements ("+i+") exceeds the maximum colors length ("+this._maxColors+")";t[3*i]=-1;for(var n=0;n 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n}\n\n\nvoid main()\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 color = gl_FragColor.rgb;\n\n if (sepia > 0.0)\n {\n float gray = (color.x + color.y + color.z) / 3.0;\n vec3 grayscale = vec3(gray);\n\n color = Overlay(SEPIA_RGB, grayscale);\n\n color = grayscale + sepia * (color - grayscale);\n }\n\n vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy;\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n dir.y *= dimensions.y / dimensions.x;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n if (scratchDensity > seed && scratch != 0.0)\n {\n float phase = seed * 256.0;\n float s = mod(floor(phase), 2.0);\n float dist = 1.0 / scratchDensity;\n float d = distance(coord, vec2(seed * dist, abs(s - seed * dist)));\n if (d < seed * 0.6 + 0.4)\n {\n highp float period = scratchDensity * 10.0;\n\n float xx = coord.x * period + phase;\n float aa = abs(mod(xx, 0.5) * 4.0);\n float bb = mod(floor(xx / 0.5), 2.0);\n float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n\n float kk = 2.0 * period;\n float dw = scratchWidth / dimensions.x * (0.75 + seed);\n float dh = dw * kk;\n\n float tine = (yy - (2.0 - dh));\n\n if (tine > 0.0) {\n float _sign = sign(scratch);\n\n tine = s * tine / period + scratch + 0.1;\n tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n\n color.rgb *= tine;\n }\n }\n }\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0);\n // float _noise = snoise(d) * 0.5;\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n color += _noise * noise;\n }\n\n gl_FragColor.rgb = color;\n}\n"),this.uniforms.dimensions=new Float32Array(2),"number"==typeof e?(this.seed=e,e=null):this.seed=t,Object.assign(this,{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e)}r&&(e.__proto__=r);var t={sepia:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},scratch:{configurable:!0},scratchDensity:{configurable:!0},scratchWidth:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return((e.prototype=Object.create(r&&r.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.seed=this.seed,e.applyFilter(this,t,r,i)},t.sepia.set=function(e){this.uniforms.sepia=e},t.sepia.get=function(){return this.uniforms.sepia},t.noise.set=function(e){this.uniforms.noise=e},t.noise.get=function(){return this.uniforms.noise},t.noiseSize.set=function(e){this.uniforms.noiseSize=e},t.noiseSize.get=function(){return this.uniforms.noiseSize},t.scratch.set=function(e){this.uniforms.scratch=e},t.scratch.get=function(){return this.uniforms.scratch},t.scratchDensity.set=function(e){this.uniforms.scratchDensity=e},t.scratchDensity.get=function(){return this.uniforms.scratchDensity},t.scratchWidth.set=function(e){this.uniforms.scratchWidth=e},t.scratchWidth.get=function(){return this.uniforms.scratchWidth},t.vignetting.set=function(e){this.uniforms.vignetting=e},t.vignetting.get=function(){return this.uniforms.vignetting},t.vignettingAlpha.set=function(e){this.uniforms.vignettingAlpha=e},t.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},t.vignettingBlur.set=function(e){this.uniforms.vignettingBlur=e},t.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(e.prototype,t),e}(n.Filter),M=function(o){function a(e,t,r){void 0===e&&(e=1),void 0===t&&(t=0),void 0===r&&(r=.1);var i=Math.max(r*a.MAX_SAMPLES,a.MIN_SAMPLES),n=(2*Math.PI/i).toFixed(7);o.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n".replace(/\$\{angleStep\}/,n)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=e,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=t,this.quality=r}o&&(a.__proto__=o);var e={color:{configurable:!0}};return((a.prototype=Object.create(o&&o.prototype)).constructor=a).prototype.apply=function(e,t,r,i){this.uniforms.thickness[0]=this.thickness/t._frame.width,this.uniforms.thickness[1]=this.thickness/t._frame.height,e.applyFilter(this,t,r,i)},e.color.get=function(){return l.rgb2hex(this.uniforms.outlineColor)},e.color.set=function(e){l.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(a.prototype,e),a}(n.Filter);M.MIN_SAMPLES=1,M.MAX_SAMPLES=100;var D=function(t){function e(e){void 0===e&&(e=10),t.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform vec2 size;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n\treturn floor( coord / size ) * size;\n}\n\nvoid main(void)\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = pixelate(coord, size);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord);\n}\n"),this.size=e}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={size:{configurable:!0}};return r.size.get=function(){return this.uniforms.size},r.size.set=function(e){"number"==typeof e&&(e=[e,e]),this.uniforms.size=e},Object.defineProperties(e.prototype,r),e}(n.Filter),R=function(n){function e(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=[0,0]),void 0===r&&(r=5),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n"),this._angle=0,this.angle=e,this.center=t,this.kernelSize=r,this.radius=i}n&&(e.__proto__=n);var t={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,t,r,i)},t.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},t.angle.get=function(){return this._angle},t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),z=function(t){function e(e){t.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n"),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e)}t&&(e.__proto__=t);var r={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(t&&t.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},r.mirror.set=function(e){this.uniforms.mirror=e},r.mirror.get=function(){return this.uniforms.mirror},r.boundary.set=function(e){this.uniforms.boundary=e},r.boundary.get=function(){return this.uniforms.boundary},r.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},r.amplitude.get=function(){return this.uniforms.amplitude},r.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},r.waveLength.get=function(){return this.uniforms.waveLength},r.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},r.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(e.prototype,r),e}(n.Filter),L=function(i){function e(e,t,r){void 0===e&&(e=[-10,0]),void 0===t&&(t=[0,10]),void 0===r&&(r=[0,0]),i.call(this,"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}","precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n"),this.red=e,this.green=t,this.blue=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return t.red.get=function(){return this.uniforms.red},t.red.set=function(e){this.uniforms.red=e},t.green.get=function(){return this.uniforms.green},t.green.set=function(e){this.uniforms.green=e},t.blue.get=function(){return this.uniforms.blue},t.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(e.prototype,t),e}(n.Filter),F=function(i){function e(e,t,r){void 0===e&&(e=[0,0]),void 0===t&&(t={}),void 0===r&&(r=0),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\n\nuniform vec2 center;\n\nuniform float amplitude;\nuniform float wavelength;\n// uniform float power;\nuniform float brightness;\nuniform float speed;\nuniform float radius;\n\nuniform float time;\n\nconst float PI = 3.14159;\n\nvoid main()\n{\n float halfWavelength = wavelength * 0.5 / filterArea.x;\n float maxRadius = radius / filterArea.x;\n float currentRadius = time * speed / filterArea.x;\n\n float fade = 1.0;\n\n if (maxRadius > 0.0) {\n if (currentRadius > maxRadius) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n }\n\n vec2 dir = vec2(vTextureCoord - center / filterArea.xy);\n dir.y *= filterArea.y / filterArea.x;\n float dist = length(dir);\n\n if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n vec2 diffUV = normalize(dir);\n\n float diff = (dist - currentRadius) / halfWavelength;\n\n float p = 1.0 - pow(abs(diff), 2.0);\n\n // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade );\n\n vec2 offset = diffUV * powDiff / filterArea.xy;\n\n // Do clamp :\n vec2 coord = vTextureCoord + offset;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n // No clamp :\n // gl_FragColor = texture2D(uSampler, vTextureCoord + offset);\n\n color.rgb *= 1.0 + (brightness - 1.0) * p * fade;\n\n gl_FragColor = color;\n}\n"),this.center=e,Array.isArray(t)&&(console.warn("Deprecated Warning: ShockwaveFilter params Array has been changed to options Object."),t={}),t=Object.assign({amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},t),this.amplitude=t.amplitude,this.wavelength=t.wavelength,this.brightness=t.brightness,this.speed=t.speed,this.radius=t.radius,this.time=r}i&&(e.__proto__=i);var t={center:{configurable:!0},amplitude:{configurable:!0},wavelength:{configurable:!0},brightness:{configurable:!0},speed:{configurable:!0},radius:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.time=this.time,e.applyFilter(this,t,r,i)},t.center.get=function(){return this.uniforms.center},t.center.set=function(e){this.uniforms.center=e},t.amplitude.get=function(){return this.uniforms.amplitude},t.amplitude.set=function(e){this.uniforms.amplitude=e},t.wavelength.get=function(){return this.uniforms.wavelength},t.wavelength.set=function(e){this.uniforms.wavelength=e},t.brightness.get=function(){return this.uniforms.brightness},t.brightness.set=function(e){this.uniforms.brightness=e},t.speed.get=function(){return this.uniforms.speed},t.speed.set=function(e){this.uniforms.speed=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},Object.defineProperties(e.prototype,t),e}(n.Filter),j=function(i){function e(e,t,r){void 0===t&&(t=0),void 0===r&&(r=1),i.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D uLightmap;\nuniform vec4 filterArea;\nuniform vec2 dimensions;\nuniform vec4 ambientColor;\nvoid main() {\n vec4 diffuseColor = texture2D(uSampler, vTextureCoord);\n vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions;\n vec4 light = texture2D(uLightmap, lightCoord);\n vec3 ambient = ambientColor.rgb * ambientColor.a;\n vec3 intensity = ambient + light.rgb;\n vec3 finalColor = diffuseColor.rgb * intensity;\n gl_FragColor = vec4(finalColor, diffuseColor.a);\n}\n"),this.uniforms.dimensions=new Float32Array(2),this.uniforms.ambientColor=new Float32Array([0,0,0,r]),this.texture=e,this.color=t}i&&(e.__proto__=i);var t={texture:{configurable:!0},color:{configurable:!0},alpha:{configurable:!0}};return((e.prototype=Object.create(i&&i.prototype)).constructor=e).prototype.apply=function(e,t,r,i){this.uniforms.dimensions[0]=t.filterFrame.width,this.uniforms.dimensions[1]=t.filterFrame.height,e.applyFilter(this,t,r,i)},t.texture.get=function(){return this.uniforms.uLightmap},t.texture.set=function(e){this.uniforms.uLightmap=e},t.color.set=function(e){var t=this.uniforms.ambientColor;"number"==typeof e?(l.hex2rgb(e,t),this._color=e):(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._color=l.rgb2hex(t))},t.color.get=function(){return this._color},t.alpha.get=function(){return this.uniforms.ambientColor[3]},t.alpha.set=function(e){this.uniforms.ambientColor[3]=e},Object.defineProperties(e.prototype,t),e}(n.Filter),N=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.uniforms.blur=e,this.uniforms.gradientBlur=t,this.uniforms.start=r||new f.Point(0,window.innerHeight/2),this.uniforms.end=i||new f.Point(600,window.innerHeight/2),this.uniforms.delta=new f.Point(30,30),this.uniforms.texSize=new f.Point(window.innerWidth,window.innerHeight),this.updateDelta()}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},t.blur.get=function(){return this.uniforms.blur},t.blur.set=function(e){this.uniforms.blur=e},t.gradientBlur.get=function(){return this.uniforms.gradientBlur},t.gradientBlur.set=function(e){this.uniforms.gradientBlur=e},t.start.get=function(){return this.uniforms.start},t.start.set=function(e){this.uniforms.start=e,this.updateDelta()},t.end.get=function(){return this.uniforms.end},t.end.set=function(e){this.uniforms.end=e,this.updateDelta()},Object.defineProperties(e.prototype,t),e}(n.Filter),B=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=e/r,this.uniforms.delta.y=t/r},t}(N),U=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.updateDelta=function(){var e=this.uniforms.end.x-this.uniforms.start.x,t=this.uniforms.end.y-this.uniforms.start.y,r=Math.sqrt(e*e+t*t);this.uniforms.delta.x=-t/r,this.uniforms.delta.y=e/r},t}(N),X=function(n){function e(e,t,r,i){void 0===e&&(e=100),void 0===t&&(t=600),void 0===r&&(r=null),void 0===i&&(i=null),n.call(this),this.tiltShiftXFilter=new B(e,t,r,i),this.tiltShiftYFilter=new U(e,t,r,i)}n&&(e.__proto__=n);var t={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return((e.prototype=Object.create(n&&n.prototype)).constructor=e).prototype.apply=function(e,t,r){var i=e.getFilterTexture();this.tiltShiftXFilter.apply(e,t,i),this.tiltShiftYFilter.apply(e,i,r),e.returnFilterTexture(i)},t.blur.get=function(){return this.tiltShiftXFilter.blur},t.blur.set=function(e){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=e},t.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},t.gradientBlur.set=function(e){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=e},t.start.get=function(){return this.tiltShiftXFilter.start},t.start.set=function(e){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=e},t.end.get=function(){return this.tiltShiftXFilter.end},t.end.set=function(e){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=e},Object.defineProperties(e.prototype,t),e}(n.Filter),H=function(i){function e(e,t,r){void 0===e&&(e=200),void 0===t&&(t=4),void 0===r&&(r=20),i.call(this,"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}","varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n"),this.radius=e,this.angle=t,this.padding=r}i&&(e.__proto__=i),(e.prototype=Object.create(i&&i.prototype)).constructor=e;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(e){this.uniforms.offset=e},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(e){this.uniforms.radius=e},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(e.prototype,t),e}(n.Filter),G=function(n){function e(e,t,r,i){void 0===e&&(e=.1),void 0===t&&(t=[0,0]),void 0===r&&(r=0),void 0===i&&(i=-1),n.call(this,"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}","varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n"),this.center=t,this.strength=e,this.innerRadius=r,this.radius=i}n&&(e.__proto__=n),(e.prototype=Object.create(n&&n.prototype)).constructor=e;var t={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return t.center.get=function(){return this.uniforms.uCenter},t.center.set=function(e){this.uniforms.uCenter=e},t.strength.get=function(){return this.uniforms.uStrength},t.strength.set=function(e){this.uniforms.uStrength=e},t.innerRadius.get=function(){return this.uniforms.uInnerRadius},t.innerRadius.set=function(e){this.uniforms.uInnerRadius=e},t.radius.get=function(){return this.uniforms.uRadius},t.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(e.prototype,t),e}(n.Filter);return e.AdjustmentFilter=t,e.AdvancedBloomFilter=i,e.AsciiFilter=o,e.BevelFilter=a,e.BloomFilter=g,e.BulgePinchFilter=v,e.CRTFilter=w,e.ColorMapFilter=_,e.ColorReplaceFilter=y,e.ConvolutionFilter=b,e.CrossHatchFilter=x,e.DotFilter=T,e.DropShadowFilter=k,e.EmbossFilter=P,e.GlitchFilter=S,e.GlowFilter=E,e.GodrayFilter=A,e.KawaseBlurFilter=d,e.MotionBlurFilter=C,e.MultiColorReplaceFilter=I,e.OldFilmFilter=O,e.OutlineFilter=M,e.PixelateFilter=D,e.RGBSplitFilter=L,e.RadialBlurFilter=R,e.ReflectionFilter=z,e.ShockwaveFilter=F,e.SimpleLightmapFilter=j,e.TiltShiftAxisFilter=N,e.TiltShiftFilter=X,e.TiltShiftXFilter=B,e.TiltShiftYFilter=U,e.TwistFilter=H,e.ZoomBlurFilter=G,e}({},PIXI,PIXI,PIXI,PIXI.utils,PIXI,PIXI.filters,PIXI.filters),pixi_projection,pixi_projection;Object.assign(PIXI.filters,__filters),this.PIXI=this.PIXI||{},function(p,v){"use strict";var t,f,d=function(){function f(e,t,r){this.value=e,this.time=t,this.next=null,this.isStepped=!1,this.ease=r?"function"==typeof r?r:p.ParticleUtils.generateEase(r):null}return f.createList=function(e){if("list"in e){var t=e.list,r=void 0,i=void 0,n=t[0],o=n.value,a=n.time;if(i=r=new f("string"==typeof o?p.ParticleUtils.hexToRGB(o):o,a,e.ease),2a.time;)n=a,a=e[++o];l=(l-n.time)/(a.time-n.time);var u=f.hexToRGB(n.value),h=f.hexToRGB(a.value),c={r:(h.r-u.r)*l+u.r,g:(h.g-u.g)*l+u.g,b:(h.b-u.b)*l+u.b};i.next=new d(c,s/t),i=i.next}return r};var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){function e(e){void 0===e&&(e=!1),this.current=null,this.next=null,this.isColor=!!e,this.interpolate=null,this.ease=null}return e.prototype.reset=function(e){this.current=e,this.next=e.next,this.next&&1<=this.next.time?this.interpolate=this.isColor?a:r:e.isStepped?this.interpolate=this.isColor?c:u:this.interpolate=this.isColor?l:s,this.ease=this.current.ease},e}();function r(e){return this.ease&&(e=this.ease(e)),(this.next.value-this.current.value)*e+this.current.value}function a(e){this.ease&&(e=this.ease(e));var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function s(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;return e=(e-this.current.time)/(this.next.time-this.current.time),(this.next.value-this.current.value)*e+this.current.value}function l(e){for(this.ease&&(e=this.ease(e));e>this.next.time;)this.current=this.next,this.next=this.next.next;e=(e-this.current.time)/(this.next.time-this.current.time);var t=this.current.value,r=this.next.value,i=(r.r-t.r)*e+t.r,n=(r.g-t.g)*e+t.g,o=(r.b-t.b)*e+t.b;return p.ParticleUtils.combineRGBComponents(i,n,o)}function u(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;return this.current.value}function c(e){for(this.ease&&(e=this.ease(e));this.next&&e>this.next.time;)this.current=this.next,this.next=this.next.next;var t=this.current.value;return p.ParticleUtils.combineRGBComponents(t.r,t.g,t.b)}var m,g=function(r){function i(e){var t=r.call(this)||this;return t.emitter=e,t.anchor.x=t.anchor.y=.5,t.velocity=new v.Point,t.rotationSpeed=0,t.rotationAcceleration=0,t.maxLife=0,t.age=0,t.ease=null,t.extraData=null,t.alphaList=new o,t.speedList=new o,t.speedMultiplier=1,t.acceleration=new v.Point,t.maxSpeed=NaN,t.scaleList=new o,t.scaleMultiplier=1,t.colorList=new o(!0),t._doAlpha=!1,t._doScale=!1,t._doSpeed=!1,t._doAcceleration=!1,t._doColor=!1,t._doNormalMovement=!1,t._oneOverLife=0,t.next=null,t.prev=null,t.init=t.init,t.Particle_init=i.prototype.init,t.update=t.update,t.Particle_update=i.prototype.update,t.Sprite_destroy=r.prototype.destroy,t.Particle_destroy=i.prototype.destroy,t.applyArt=t.applyArt,t.kill=t.kill,t}return n(i,r),i.prototype.init=function(){this.age=0,this.velocity.x=this.speedList.current.value*this.speedMultiplier,this.velocity.y=0,p.ParticleUtils.rotatePoint(this.rotation,this.velocity),this.noRotation?this.rotation=0:this.rotation*=p.ParticleUtils.DEG_TO_RADS,this.rotationSpeed*=p.ParticleUtils.DEG_TO_RADS,this.rotationAcceleration*=p.ParticleUtils.DEG_TO_RADS,this.alpha=this.alphaList.current.value,this.scale.x=this.scale.y=this.scaleList.current.value,this._doAlpha=!!this.alphaList.current.next,this._doSpeed=!!this.speedList.current.next,this._doScale=!!this.scaleList.current.next,this._doColor=!!this.colorList.current.next,this._doAcceleration=0!==this.acceleration.x||0!==this.acceleration.y,this._doNormalMovement=this._doSpeed||0!==this.speedList.current.value||this._doAcceleration,this._oneOverLife=1/this.maxLife;var e=this.colorList.current.value;this.tint=p.ParticleUtils.combineRGBComponents(e.r,e.g,e.b),this.visible=!0},i.prototype.applyArt=function(e){this.texture=e||v.Texture.EMPTY},i.prototype.update=function(e){if(this.age+=e,this.age>=this.maxLife||this.age<0)return this.kill(),-1;var t=this.age*this._oneOverLife;if(this.ease&&(t=4==this.ease.length?this.ease(t,0,1,1):this.ease(t)),this._doAlpha&&(this.alpha=this.alphaList.interpolate(t)),this._doScale){var r=this.scaleList.interpolate(t)*this.scaleMultiplier;this.scale.x=this.scale.y=r}if(this._doNormalMovement){var i=void 0,n=void 0;if(this._doSpeed){var o=this.speedList.interpolate(t)*this.speedMultiplier;p.ParticleUtils.normalize(this.velocity),p.ParticleUtils.scaleBy(this.velocity,o),i=this.velocity.x*e,n=this.velocity.y*e}else if(this._doAcceleration){var a=this.velocity.x,s=this.velocity.y;if(this.velocity.x+=this.acceleration.x*e,this.velocity.y+=this.acceleration.y*e,this.maxSpeed){var l=p.ParticleUtils.length(this.velocity);l>this.maxSpeed&&p.ParticleUtils.scaleBy(this.velocity,this.maxSpeed/l)}i=(a+this.velocity.x)/2*e,n=(s+this.velocity.y)/2*e}else i=this.velocity.x*e,n=this.velocity.y*e;this.position.x+=i,this.position.y+=n}if(this._doColor&&(this.tint=this.colorList.interpolate(t)),0!==this.rotationAcceleration){var u=this.rotationSpeed+this.rotationAcceleration*e;this.rotation+=(this.rotationSpeed+u)/2*e,this.rotationSpeed=u}else 0!==this.rotationSpeed?this.rotation+=this.rotationSpeed*e:this.acceleration&&!this.noRotation&&(this.rotation=Math.atan2(this.velocity.y,this.velocity.x));return t},i.prototype.kill=function(){this.emitter.recycle(this)},i.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.Sprite_destroy(),this.emitter=this.velocity=this.colorList=this.scaleList=this.alphaList=this.speedList=this.ease=this.next=this.prev=null},i.parseArt=function(e){var t;for(t=e.length;0<=t;--t)"string"==typeof e[t]&&(e[t]=h(e[t]));if(p.ParticleUtils.verbose)for(t=e.length-1;0=this.maxParticles)this._spawnTimer+=this._frequency;else{var l=void 0;if(l=this.minLifetime==this.maxLifetime?this.minLifetime:Math.random()*(this.maxLifetime-this.minLifetime)+this.minLifetime,-this._spawnTimer=this.spawnChance)){var p=void 0;if(this._poolFirst?(p=this._poolFirst,this._poolFirst=this._poolFirst.next,p.next=null):p=new this.particleConstructor(this),1=this.particleImages.length)&&(this._currentImageIndex=0)):p.applyArt(this.particleImages[Math.floor(Math.random()*this.particleImages.length)]):p.applyArt(this.particleImages[0]),p.alphaList.reset(this.startAlpha),1!=this.minimumSpeedMultiplier&&(p.speedMultiplier=Math.random()*(1-this.minimumSpeedMultiplier)+this.minimumSpeedMultiplier),p.speedList.reset(this.startSpeed),p.acceleration.x=this.acceleration.x,p.acceleration.y=this.acceleration.y,p.maxSpeed=this.maxSpeed,1!=this.minimumScaleMultiplier&&(p.scaleMultiplier=Math.random()*(1-this.minimumScaleMultiplier)+this.minimumScaleMultiplier),p.scaleList.reset(this.startScale),p.colorList.reset(this.startColor),this.minRotationSpeed==this.maxRotationSpeed?p.rotationSpeed=this.minRotationSpeed:p.rotationSpeed=Math.random()*(this.maxRotationSpeed-this.minRotationSpeed)+this.minRotationSpeed,p.rotationAcceleration=this.rotationAcceleration,p.noRotation=this.noRotation,p.maxLife=l,p.blendMode=this.particleBlendMode,p.ease=this.customEase,p.extraData=this.extraData,this.applyAdditionalProperties(p),this._spawnFunc(p,u,h,t),p.init(),p.update(-this._spawnTimer),p.parent){var d=this._parent.children;if(d[0]==p)d.shift();else if(d[d.length-1]==p)d.pop();else{var m=d.indexOf(p);d.splice(m,1)}this.addAtBack?d.unshift(p):d.push(p)}else this.addAtBack?this._parent.addChildAt(p,0):this._parent.addChild(p);this._activeParticlesLast?((this._activeParticlesLast.next=p).prev=this._activeParticlesLast,this._activeParticlesLast=p):this._activeParticlesLast=this._activeParticlesFirst=p,++this.particleCount}}this._spawnTimer+=this._frequency}}if(this._posChanged&&(this._prevEmitterPos.x=a,this._prevEmitterPos.y=s,this._prevPosIsValid=!0,this._posChanged=!1),!this._emit&&!this._activeParticlesFirst){if(this._completeCallback){var g=this._completeCallback;this._completeCallback=null,g()}this._destroyWhenComplete&&this.destroy()}}},e.prototype.applyAdditionalProperties=function(e){},e.prototype._spawnPoint=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,e.position.x=t,e.position.y=r},e.prototype._spawnRect=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,b.x=Math.random()*this.spawnRect.width+this.spawnRect.x,b.y=Math.random()*this.spawnRect.height+this.spawnRect.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnCircle=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,b.x=Math.random()*this.spawnCircle.radius,b.y=0,p.ParticleUtils.rotatePoint(360*Math.random(),b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnRing=function(e,t,r){var i=this.spawnCircle;this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,i.minRadius!==i.radius?b.x=Math.random()*(i.radius-i.minRadius)+i.minRadius:b.x=i.radius,b.y=0;var n=360*Math.random();e.rotation+=n,p.ParticleUtils.rotatePoint(n,b),b.x+=this.spawnCircle.x,b.y+=this.spawnCircle.y,0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnPolygonalChain=function(e,t,r){this.minStartRotation==this.maxStartRotation?e.rotation=this.minStartRotation+this.rotation:e.rotation=Math.random()*(this.maxStartRotation-this.minStartRotation)+this.minStartRotation+this.rotation,this.spawnPolygonalChain.getRandomPoint(b),0!==this.rotation&&p.ParticleUtils.rotatePoint(this.rotation,b),e.position.x=t+b.x,e.position.y=r+b.y},e.prototype._spawnBurst=function(e,t,r,i){0===this.particleSpacing?e.rotation=360*Math.random():e.rotation=this.angleStart+this.particleSpacing*i+this.rotation,e.position.x=t,e.position.y=r},e.prototype.cleanup=function(){var e,t;for(e=this._activeParticlesFirst;e;e=t)t=e.next,this.recycle(e),e.parent&&e.parent.removeChild(e);this._activeParticlesFirst=this._activeParticlesLast=null,this.particleCount=0},e.prototype.destroy=function(){var e;this.autoUpdate=!1,this.cleanup();for(var t=this._poolFirst;t;t=e)e=t.next,t.destroy();this._poolFirst=this._parent=this.particleImages=this.spawnPos=this.ownerPos=this.startColor=this.startScale=this.startAlpha=this.startSpeed=this.customEase=this._completeCallback=null},e}(),w=new v.Point,T=["pow","sqrt","abs","floor","round","ceil","E","PI","sin","cos","tan","asin","acos","atan","atan2","log"],k=new RegExp(["[01234567890\\.\\*\\-\\+\\/\\(\\)x ,]"].concat(T).join("|"),"g"),P=function(r){function e(e){var t=r.call(this,e)||this;return t.path=null,t.initialRotation=0,t.initialPosition=new v.Point,t.movement=0,t}return n(e,r),e.prototype.init=function(){this.initialRotation=this.rotation,this.Particle_init(),this.path=this.extraData.path,this._doNormalMovement=!this.path,this.movement=0,this.initialPosition.x=this.position.x,this.initialPosition.y=this.position.y},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t&&this.path){var r=this.speedList.interpolate(t)*this.speedMultiplier;this.movement+=r*e,w.x=this.movement,w.y=this.path(this.movement),p.ParticleUtils.rotatePoint(this.initialRotation,w),this.position.x=this.initialPosition.x+w.x,this.position.y=this.initialPosition.y+w.y}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.path=this.initialPosition=null},e.parseArt=function(e){return g.parseArt(e)},e.parseData=function(e){var t={};if(e&&e.path)try{t.path=function(e){for(var t=e.match(k),r=t.length-1;0<=r;--r)0<=T.indexOf(t[r])&&(t[r]="Math."+t[r]);return e=t.join(""),new Function("x","return "+e+";")}(e.path)}catch(e){p.ParticleUtils.verbose&&console.error("PathParticle: error in parsing path expression"),t.path=null}else p.ParticleUtils.verbose&&console.error("PathParticle requires a path string in extraData!"),t.path=null;return t},e}(g),S=function(r){function e(e){var t=r.call(this,e)||this;return t.textures=null,t.duration=0,t.framerate=0,t.elapsed=0,t.loop=!1,t}return n(e,r),e.prototype.init=function(){this.Particle_init(),this.elapsed=0,this.framerate<0&&(this.duration=this.maxLife,this.framerate=this.textures.length/this.duration)},e.prototype.applyArt=function(e){this.textures=e.textures,this.framerate=e.framerate,this.duration=e.duration,this.loop=e.loop},e.prototype.update=function(e){var t=this.Particle_update(e);if(0<=t){this.elapsed+=e,this.elapsed>this.duration&&(this.loop?this.elapsed=this.elapsed%this.duration:this.elapsed=this.duration-1e-6);var r=this.elapsed*this.framerate+1e-7|0;this.texture=this.textures[r]||v.Texture.EMPTY}return t},e.prototype.destroy=function(){this.Particle_destroy(),this.textures=null},e.parseArt=function(e){for(var t,r,i,n,o,a=[],s=0;st[s]&&(i=t[s]),ot[s+1]&&(n=t[s+1]),af[u]){l=c[s];c[s]=c[u],c[u]=l;var h=f[s];f[s]=f[u],f[u]=h}if(t[0]=c[0].x,t[1]=c[0].y,t[2]=c[1].x,t[3]=c[1].y,t[4]=c[2].x,t[5]=c[2].y,t[6]=c[3].x,t[7]=c[3].y,(c[3].x-c[2].x)*(c[1].y-c[2].y)-(c[1].x-c[2].x)*(c[3].y-c[2].y)<0)return t[4]=c[3].x,void(t[5]=c[3].y)}},e}();e.Surface=t}(pixi_projection||(pixi_projection={})),function(e){var k=new PIXI.Matrix,n=new PIXI.Rectangle,P=new PIXI.Point,t=function(t){function e(){var e=t.call(this)||this;return e.distortion=new PIXI.Point,e}return __extends(e,t),e.prototype.clear=function(){this.distortion.set(0,0)},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.distortion,i=e.x*e.y;return t.x=e.x+r.x*i,t.y=e.y+r.y*i,t},e.prototype.applyInverse=function(e,t){t=t||new PIXI.Point;var r=e.x,i=e.y,n=this.distortion.x,o=this.distortion.y;if(0==n)t.x=r,t.y=i/(1+o*r);else if(0==o)t.y=i,t.x=r/(1+n*i);else{var a=.5*(i*n-r*o+1)/o,s=a*a+r/o;if(s<=1e-5)return void t.set(NaN,NaN);t.x=0 vFrame.z ||\n pixels.y < vFrame.y || pixels.y > vFrame.w) {\n uv.x = vTrans1.x * surface2.x + vTrans1.y * surface2.y + vTrans1.z;\n uv.y = vTrans2.x * surface2.x + vTrans2.y * surface2.y + vTrans2.z;\n pixels = uv * vSamplerSize;\n \n// if (pixels.x < vFrame.x || pixels.x > vFrame.z ||\n// pixels.y < vFrame.y || pixels.y > vFrame.w) {\n// discard;\n// }\n}\n\nvec4 edge;\nedge.xy = clamp(pixels - vFrame.xy + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\nedge.zw = clamp(vFrame.zw - pixels + 0.5, vec2(0.0, 0.0), vec2(1.0, 1.0));\n\nfloat alpha = 1.0; //edge.x * edge.y * edge.z * edge.w;\nvec4 rColor = vColor * alpha;\n\nfloat textureId = floor(vTextureId+0.5);\nvec2 vTextureCoord = uv;\nvec4 color;\n%forloop%\ngl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n//gl_FragColor = color * rColor;\n}",geometryClass:s,vertexSize:16},e),i=t.vertex,n=t.fragment,o=t.vertexSize,a=t.geometryClass;return function(r){function e(e){var t=r.call(this,e)||this;return t.defUniforms={translationMatrix:new PIXI.Matrix,distortion:new Float32Array([0,0])},t.size=1e3,t.forceMaxTextures=1,t.shaderGenerator=new PIXI.BatchShaderGenerator(i,n),t.geometryClass=a,t.vertexSize=o,t}return __extends(e,r),e.prototype.getUniforms=function(e){var t=e.proj;return null!==t.surface?t.uniforms:null!==t._activeProjection?t._activeProjection.uniforms:this.defUniforms},e.prototype.packInterleavedGeometry=function(e,t,r,i,n){for(var o=t.uint32View,a=t.float32View,s=i/this.vertexSize,l=e.indices,u=e.vertexData,h=e._texture._frame,c=e.aTrans,f=e._texture.baseTexture,p=f._batchLocation,d=f.realWidth,m=f.realHeight,g=f.resolution,v=Math.min(e.worldAlpha,1),_=v<1&&e._texture.baseTexture.alphaMode?b(e._tintRGB,v):e._tintRGB+(255*v<<24),y=0;y=o.TRANSFORM_STEP.PROJ?(i||this.displayObjectUpdateTransform(),this.proj.affine?this.transform.worldTransform.applyInverse(e,r):this.proj.world.applyInverse(e,r)):(this.parent?r=this.parent.worldTransform.applyInverse(e,r):r.copyFrom(e),n===o.TRANSFORM_STEP.NONE?r:this.transform.localTransform.applyInverse(r,r))},Object.defineProperty(e.prototype,"worldTransform",{get:function(){return this.proj.affine?this.transform.worldTransform:this.proj.world},enumerable:!0,configurable:!0}),e}(PIXI.Container);o.Container2d=e,o.container2dToLocal=e.prototype.toLocal}(pixi_projection||(pixi_projection={})),function(e){var l,t,v=PIXI.Point,r=[1,0,0,0,1,0,0,0,1];(t=l=e.AFFINE||(e.AFFINE={}))[t.NONE=0]="NONE",t[t.FREE=1]="FREE",t[t.AXIS_X=2]="AXIS_X",t[t.AXIS_Y=3]="AXIS_Y",t[t.POINT=4]="POINT",t[t.AXIS_XR=5]="AXIS_XR";var i=function(){function e(e){this.floatArray=null,this.mat3=new Float64Array(e||r)}return Object.defineProperty(e.prototype,"a",{get:function(){return this.mat3[0]/this.mat3[8]},set:function(e){this.mat3[0]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"b",{get:function(){return this.mat3[1]/this.mat3[8]},set:function(e){this.mat3[1]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"c",{get:function(){return this.mat3[3]/this.mat3[8]},set:function(e){this.mat3[3]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"d",{get:function(){return this.mat3[4]/this.mat3[8]},set:function(e){this.mat3[4]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tx",{get:function(){return this.mat3[6]/this.mat3[8]},set:function(e){this.mat3[6]=e*this.mat3[8]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ty",{get:function(){return this.mat3[7]/this.mat3[8]},set:function(e){this.mat3[7]=e*this.mat3[8]},enumerable:!0,configurable:!0}),e.prototype.set=function(e,t,r,i,n,o){var a=this.mat3;return a[0]=e,a[1]=t,a[2]=0,a[3]=r,a[4]=i,a[5]=0,a[6]=n,a[7]=o,a[8]=1,this},e.prototype.toArray=function(e,t){this.floatArray||(this.floatArray=new Float32Array(9));var r=t||this.floatArray,i=this.mat3;return e?(r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7]):(r[0]=i[0],r[1]=i[3],r[2]=i[6],r[3]=i[1],r[4]=i[4],r[5]=i[7],r[6]=i[2],r[7]=i[5]),r[8]=i[8],r},e.prototype.apply=function(e,t){t=t||new PIXI.Point;var r=this.mat3,i=e.x,n=e.y,o=1/(r[2]*i+r[5]*n+r[8]);return t.x=o*(r[0]*i+r[3]*n+r[6]),t.y=o*(r[1]*i+r[4]*n+r[7]),t},e.prototype.translate=function(e,t){var r=this.mat3;return r[0]+=e*r[2],r[1]+=t*r[2],r[3]+=e*r[5],r[4]+=t*r[5],r[6]+=e*r[8],r[7]+=t*r[8],this},e.prototype.scale=function(e,t){var r=this.mat3;return r[0]*=e,r[1]*=t,r[3]*=e,r[4]*=t,r[6]*=e,r[7]*=t,this},e.prototype.scaleAndTranslate=function(e,t,r,i){var n=this.mat3;n[0]=e*n[0]+r*n[2],n[1]=t*n[1]+i*n[2],n[3]=e*n[3]+r*n[5],n[4]=t*n[4]+i*n[5],n[6]=e*n[6]+r*n[8],n[7]=t*n[7]+i*n[8]},e.prototype.applyInverse=function(e,t){t=t||new v;var r=this.mat3,i=e.x,n=e.y,o=r[0],a=r[3],s=r[6],l=r[1],u=r[4],h=r[7],c=r[2],f=r[5],p=r[8],d=(p*u-h*f)*i+(-p*a+s*f)*n+(h*a-s*u),m=(-p*l+h*c)*i+(p*o-s*c)*n+(-h*o+s*l),g=(f*l-u*c)*i+(-f*o+a*c)*n+(u*o-a*l);return t.x=d/g,t.y=m/g,t},e.prototype.invert=function(){var e=this.mat3,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],h=u*o-a*l,c=-u*n+a*s,f=l*n-o*s,p=t*h+r*c+i*f;return p&&(p=1/p,e[0]=h*p,e[1]=(-u*r+i*l)*p,e[2]=(a*r-i*o)*p,e[3]=c*p,e[4]=(u*t-i*s)*p,e[5]=(-a*t+i*n)*p,e[6]=f*p,e[7]=(-l*t+r*s)*p,e[8]=(o*t-r*n)*p),this},e.prototype.identity=function(){var e=this.mat3;return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,this},e.prototype.clone=function(){return new e(this.mat3)},e.prototype.copyTo2dOr3d=function(e){var t=this.mat3,r=e.mat3;return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],e},e.prototype.copyTo=function(e,t,r){var i=this.mat3,n=1/i[8],o=i[6]*n,a=i[7]*n;if(e.a=(i[0]-i[2]*o)*n,e.b=(i[1]-i[2]*a)*n,e.c=(i[3]-i[5]*o)*n,e.d=(i[4]-i[5]*a)*n,e.tx=o,e.ty=a,2<=t){var s=e.a*e.d-e.b*e.c;r||(s=Math.abs(s)),t===l.POINT?(s=0>0,0!==f._cycle&&f._cycle===f._totalTime/a&&m<=e&&f._cycle--,f._time=f._totalTime-f._cycle*a,f._yoyo&&0!=(1&f._cycle)&&(f._time=v-f._time,(c=f._yoyoEase||f.vars.yoyoEase)&&(f._yoyoEase||(!0!==c||f._initted?f._yoyoEase=c=!0===c?f._ease:c instanceof Ease?c:Ease.map[c]:(c=f.vars.ease,f._yoyoEase=c=c?c instanceof Ease?c:"function"==typeof c?new Ease(c,f.vars.easeParams):Ease.map[c]||y.defaultEase:y.defaultEase)),f.ratio=c?1-c.getRatio((v-f._time)/v):0)),f._time>v?f._time=v:f._time<0&&(f._time=0)),f._easeType&&!c?(s=f._time/v,(1===(l=f._easeType)||3===l&&.5<=s)&&(s=1-s),3===l&&(s*=2),1===(u=f._easePower)?s*=s:2===u?s*=s*s:3===u?s*=s*s*s:4===u&&(s*=s*s*s*s),f.ratio=1===l?1-s:2===l?s:f._time/v<.5?s/2:1-s/2):c||(f.ratio=f._ease.getRatio(f._time/v))),d!==f._time||r||g!==f._cycle){if(!f._initted){if(f._init(),!f._initted||f._gc)return;if(!r&&f._firstPT&&(!1!==f.vars.lazy&&f._duration||f.vars.lazy&&!f._duration))return f._time=d,f._totalTime=m,f._rawPrevTime=_,f._cycle=g,x.lazyTweens.push(f),void(f._lazy=[e,t]);!f._time||i||c?i&&this._ease._calcEnd&&!c&&(f.ratio=f._ease.getRatio(0===f._time?0:1)):f.ratio=f._ease.getRatio(f._time/v)}for(!1!==f._lazy&&(f._lazy=!1),f._active||!f._paused&&f._time!==d&&0<=e&&(f._active=!0),0===m&&(2===f._initted&&0e._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}c._onUpdate&&(t||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}f._onUpdate&&(t||(C.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(C.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].time>0||6)-1,c=[],f=[];for(r in e)d(e[r],a,t);for(n=a.length,i=0;i>0]=f,s[o]=u,l=0,f=[]);return{length:u,lengths:s,segments:c}}(this._beziers,this._timeRes);this._length=f.length,this._lengths=f.lengths,this._segments=f.segments,this._l1=this._li=this._s1=this._si=0,this._l2=this._lengths[0],this._curSeg=this._segments[0],this._s2=this._curSeg[0],this._prec=1/this._curSeg.length}if(c=this._autoRotate)for(this._initialRotations=[],c[0]instanceof Array||(this._autoRotate=c=[c]),o=c.length;-1<--o;){for(a=0;a<3;a++)i=c[o][a],this._func[i]="function"==typeof e[i]&&e[i.indexOf("set")||"function"!=typeof e["get"+i.substr(3)]?i:"get"+i.substr(3)];i=c[o][2],this._initialRotations[o]=(this._func[i]?this._func[i].call(this._target):this._target[i])||0,this._overwriteProps.push(i)}return this._startRatio=r.vars.runBackwards?1:0,!0},set:function(e){var t,r,i,n,o,a,s,l,u,h,c,f=this._segCount,p=this._func,d=this._target,m=e!==this._startRatio;if(this._timeRes){if(u=this._lengths,h=this._curSeg,c=e*this._length,i=this._li,c>this._l2&&i=c;);0===i&&cthis._s2&&i=c;);0===i&&c>0)*(1/f))*f;for(r=1-a,i=this._props.length;-1<--i;)n=this._props[i],s=(a*a*(o=this._beziers[n][t]).da+3*r*(a*o.ca+r*o.ba))*a+o.a,this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s;if(this._autoRotate){var g,v,_,y,b,x,w,T=this._autoRotate;for(i=T.length;-1<--i;)n=T[i][2],x=T[i][3]||0,w=!0===T[i][4]?1:k,o=this._beziers[T[i][0]],g=this._beziers[T[i][1]],o&&g&&(o=o[t],g=g[t],v=o.a+(o.b-o.a)*a,v+=((y=o.b+(o.c-o.b)*a)-v)*a,y+=(o.c+(o.d-o.c)*a-y)*a,_=g.a+(g.b-g.a)*a,_+=((b=g.b+(g.c-g.b)*a)-_)*a,b+=(g.c+(g.d-g.c)*a-b)*a,s=m?Math.atan2(b-_,y-v)*w+x:this._initialRotations[i],this._mod[n]&&(s=this._mod[n](s,d)),p[n]?d[n](s):d[n]=s)}}}),e=g.prototype,g.bezierThrough=p,g.cubicToQuadratic=P,g._autoCSS=!0,g.quadraticToCubic=function(e,t,r){return new _(e,(2*t+e)/3,(2*t+r)/3,r)},g._cssRegister=function(){var e=r.CSSPlugin;if(e){var t=e._internals,p=t._parseToProxy,d=t._setPluginRatio,m=t.CSSPropTween;t._registerComplexSpecialProp("bezier",{parser:function(e,t,r,i,n,o){t instanceof Array&&(t={values:t}),o=new g;var a,s,l,u=t.values,h=u.length-1,c=[],f={};if(h<0)return n;for(a=0;a<=h;a++)l=p(e,u[a],i,n,o,h!==a),c[a]=l.end;for(s in t)f[s]=t[s];return f.values=c,(n=new m(e,"bezier",0,0,l.pt,2)).data=l,n.plugin=o,n.setRatio=d,0===f.autoRotate&&(f.autoRotate=!0),!f.autoRotate||f.autoRotate instanceof Array||(a=!0===f.autoRotate?0:Number(f.autoRotate),f.autoRotate=null!=l.end.left?[["left","top","rotation",a,!1]]:null!=l.end.x&&[["x","y","rotation",a,!1]]),f.autoRotate&&(i._transform||i._enableTransforms(!1),l.autoRotate=i._target._gsTransform,l.proxy.rotation=l.autoRotate.rotation||0,i._overwriteProps.push("rotation")),o._onInitTween(l.proxy,f,i._tween),n}})}},e._mod=function(e){for(var t,r=this._overwriteProps,i=r.length;-1<--i;)(t=e[r[i]])&&"function"==typeof t&&(this._mod[r[i]]=t)},e._kill=function(e){var t,r,i=this._props;for(t in this._beziers)if(t in e)for(delete this._beziers[t],delete this._func[t],r=i.length;-1<--r;)i[r]===t&&i.splice(r,1);if(i=this._autoRotate)for(r=i.length;-1<--r;)e[i[r][2]]&&i.splice(r,1);return this._super._kill.call(this,e)},_gsScope._gsDefine("plugins.CSSPlugin",["plugins.TweenPlugin","TweenLite"],function(o,B){var d,k,P,m,U=function(){o.call(this,"css"),this._overwriteProps.length=0,this.setRatio=U.prototype.setRatio},u=_gsScope._gsDefine.globals,g={},e=U.prototype=new o("css");(e.constructor=U).version="2.1.3",U.API=2,U.defaultTransformPerspective=0,U.defaultSkewType="compensated",U.defaultSmoothOrigin=!0,e="px",U.suffixMap={top:e,right:e,bottom:e,left:e,width:e,height:e,fontSize:e,padding:e,margin:e,perspective:e,lineHeight:""};var E,v,_,F,y,S,A,C,t,r,I=/(?:\-|\.|\b)(\d|\.|e\-)+/g,O=/(?:\d|\-\d|\.\d|\-\.\d|\+=\d|\-=\d|\+=.\d|\-=\.\d)+/g,b=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi,n=/(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b),?/gi,h=/(?![+-]?\d*\.?\d+|[+-]|e[+-]\d+)[^0-9]/g,M=/(?:\d|\-|\+|=|#|\.)*/g,D=/opacity *= *([^)]*)/i,x=/opacity:([^;]*)/i,a=/alpha\(opacity *=.+?\)/i,w=/^(rgb|hsl)/,s=/([A-Z])/g,l=/-([a-z])/gi,T=/(^(?:url\(\"|url\())|(?:(\"\))$|\)$)/gi,c=function(e,t){return t.toUpperCase()},p=/(?:Left|Right|Width)/i,f=/(M11|M12|M21|M22)=[\d\-\.e]+/gi,R=/progid\:DXImageTransform\.Microsoft\.Matrix\(.+?\)/i,z=/,(?=[^\)]*(?:\(|$))/gi,L=/[\s,\(]/i,j=Math.PI/180,X=180/Math.PI,N={},i={style:{}},H=_gsScope.document||{createElement:function(){return i}},G=function(e,t){var r=H.createElementNS?H.createElementNS(t||"http://www.w3.org/1999/xhtml",e):H.createElement(e);return r.style?r:H.createElement(e)},W=G("div"),q=G("img"),V=U._internals={_specialProps:g},Y=(_gsScope.navigator||{}).userAgent||"",Z=(t=Y.indexOf("Android"),r=G("a"),_=-1!==Y.indexOf("Safari")&&-1===Y.indexOf("Chrome")&&(-1===t||3>16,e>>8&255,255&e];else{if(","===e.charAt(e.length-1)&&(e=e.substr(0,e.length-1)),me[e])r=me[e];else if("#"===e.charAt(0))4===e.length&&(e="#"+(i=e.charAt(1))+i+(n=e.charAt(2))+n+(o=e.charAt(3))+o),r=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e];else if("hsl"===e.substr(0,3))if(r=f=e.match(I),t){if(-1!==e.indexOf("="))return e.match(O)}else a=Number(r[0])%360/360,s=Number(r[1])/100,i=2*(l=Number(r[2])/100)-(n=l<=.5?l*(s+1):l+s-l*s),3i--)for(;++ii--)for(;++i>0];return i.parse(e,a,n,o)}},we=(V._setPluginRatio=function(e){this.plugin.setRatio(e);for(var t,r,i,n,o,a=this.data,s=a.proxy,l=a.firstMPT;l;)t=s[l.v],l.r?t=l.r(t):t<1e-6&&-1e-6s.length?l.length:s.length,a=0;ao.pr;)a=a._next;(o._prev=a?a._prev:l)?o._prev._next=o:s=o,(o._next=a)?a._prev=o:l=o,o=u}this._firstPT=s}return!0},e.parse=function(e,t,r,i){var n,o,a,s,l,u,h,c,f,p,d=e.style;for(n in t){if(u=t[n],o=g[n],"function"!=typeof u||o&&o.allowFunc||(u=u(C,A)),o)r=o.parse(e,u,n,this,r,i,t);else{if("--"===n.substr(0,2)){this._tween._propLookup[n]=this._addTween.call(this._tween,e.style,"setProperty",re(e).getPropertyValue(n)+"",u+"",n,!1,n);continue}l=ie(e,n,P)+"",f="string"==typeof u,"color"===n||"fill"===n||"stroke"===n||-1!==n.indexOf("Color")||f&&w.test(u)?(f||(u=(3<(u=ve(u)).length?"rgba(":"rgb(")+u.join(",")+")"),r=Pe(d,n,l,u,!0,"transparent",r,0,i)):f&&L.test(u)?r=Pe(d,n,l,u,!0,null,r,0,i):(h=(a=parseFloat(l))||0===a?l.substr((a+"").length):"",""!==l&&"auto"!==l||(h="width"===n||"height"===n?(a=he(e,n,P),"px"):"left"===n||"top"===n?(a=oe(e,n,P),"px"):(a="opacity"!==n?0:1,"")),""===(c=(p=f&&"="===u.charAt(1))?(s=parseInt(u.charAt(0)+"1",10),u=u.substr(2),s*=parseFloat(u),u.replace(M,"")):(s=parseFloat(u),f?u.replace(M,""):""))&&(c=n in k?k[n]:h),u=s||0===s?(p?s+a:s)+c:t[n],h!==c&&(""===c&&"lineHeight"!==n||(s||0===s)&&a&&(a=ne(e,n,a,h),"%"===c?(a/=ne(e,n,100,"%")/100,!0!==t.strictUnits&&(l=a+"%")):"em"===c||"rem"===c||"vw"===c||"vh"===c?a/=ne(e,n,1,c):"px"!==c&&(s=ne(e,n,s,c),c="px"),p&&(s||0===s)&&(u=s+a+c))),p&&(s+=a),!a&&0!==a||!s&&0!==s?void 0!==d[n]&&(u||u+""!="NaN"&&null!=u)?(r=new Te(d,n,s||a||0,0,r,-1,n,!1,0,l,u)).xs0="none"!==u||"display"!==n&&-1===n.indexOf("Style")?u:l:K("invalid "+n+" tween value: "+t[n]):(r=new Te(d,n,a,s-a,r,0,n,!1!==E&&("px"===c||"zIndex"===n),0,l,u)).xs0=c)}i&&r&&!r.plugin&&(r.plugin=i)}return r},e.setRatio=function(e){var t,r,i,n=this._firstPT;if(1!==e||this._tween._time!==this._tween._duration&&0!==this._tween._time)if(e||this._tween._time!==this._tween._duration&&0!==this._tween._time||-1e-6===this._tween._rawPrevTime)for(;n;){if(t=n.c*e+n.s,n.r?t=n.r(t):t<1e-6&&-1e-6this._p3?this._calcEnd?1===e?0:1-(e=(e-this._p3)/this._p1)*e:t+(e-t)*(e=(e-this._p3)/this._p1)*e*e*e:this._calcEnd?1:t},d.ease=new d(.7,.7),m.config=d.config=function(e,t,r){return new d(e,t,r)},(m=(r=l("easing.SteppedEase",function(e,t){e=e||1,this._p1=1/e,this._p2=e+(t?0:1),this._p3=t?1:0},!0)).prototype=new g).constructor=r,m.getRatio=function(e){return e<0?e=0:1<=e&&(e=.999999999),((this._p2*e|0)+this._p3)*this._p1},m.config=r.config=function(e,t){return new r(e,t)},(m=(i=l("easing.ExpoScaleEase",function(e,t,r){this._p1=Math.log(t/e),this._p2=t-e,this._p3=e,this._ease=r},!0)).prototype=new g).constructor=i,m.getRatio=function(e){return this._ease&&(e=this._ease.getRatio(e)),(this._p3*Math.exp(this._p1*e)-this._p3)/this._p2},m.config=i.config=function(e,t,r){return new i(e,t,r)},(m=(t=l("easing.RoughEase",function(e){for(var t,r,i,n,o,a,s=(e=e||{}).taper||"none",l=[],u=0,h=0|(e.points||20),c=h,f=!1!==e.randomize,p=!0===e.clamp,d=e.template instanceof g?e.template:null,m="number"==typeof e.strength?.4*e.strength:.4;-1<--c;)t=f?Math.random():1/h*c,r=d?d.getRatio(t):t,i="none"===s?m:"out"===s?(n=1-t)*n*m:"in"===s?t*t*m:t<.5?(n=2*t)*n*.5*m:(n=2*(1-t))*n*.5*m,f?r+=Math.random()*i-.5*i:c%2?r+=.5*i:r-=.5*i,p&&(1t.t){for(;t.next&&e>=t.t;)t=t.next;t=t.prev}else for(;t.prev&&e<=t.t;)t=t.prev;return(this._prev=t).v+(e-t.t)/t.gap*t.c},m.config=function(e){return new t(e)},t.ease=new t,c("Bounce",u("BounceOut",function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}),u("BounceIn",function(e){return(e=1-e)<1/2.75?1-7.5625*e*e:e<2/2.75?1-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?1-(7.5625*(e-=2.25/2.75)*e+.9375):1-(7.5625*(e-=2.625/2.75)*e+.984375)}),u("BounceInOut",function(e){var t=e<.5;return(e=t?1-2*e:2*e-1)<1/2.75?e*=7.5625*e:e=e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,t?.5*(1-e):.5*e+.5})),c("Circ",u("CircOut",function(e){return Math.sqrt(1-(e-=1)*e)}),u("CircIn",function(e){return-(Math.sqrt(1-e*e)-1)}),u("CircInOut",function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)})),c("Elastic",(e=function(e,t,r){var i=l("easing."+e,function(e,t){this._p1=1<=e?e:1,this._p2=(t||r)/(e<1?e:1),this._p3=this._p2/a*(Math.asin(1/this._p1)||0),this._p2=a/this._p2},!0),n=i.prototype=new g;return n.constructor=i,n.getRatio=t,n.config=function(e,t){return new i(e,t)},i})("ElasticOut",function(e){return this._p1*Math.pow(2,-10*e)*Math.sin((e-this._p3)*this._p2)+1},.3),e("ElasticIn",function(e){return-this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)},.3),e("ElasticInOut",function(e){return(e*=2)<1?this._p1*Math.pow(2,10*(e-=1))*Math.sin((e-this._p3)*this._p2)*-.5:this._p1*Math.pow(2,-10*(e-=1))*Math.sin((e-this._p3)*this._p2)*.5+1},.45)),c("Expo",u("ExpoOut",function(e){return 1-Math.pow(2,-10*e)}),u("ExpoIn",function(e){return Math.pow(2,10*(e-1))-.001}),u("ExpoInOut",function(e){return(e*=2)<1?.5*Math.pow(2,10*(e-1)):.5*(2-Math.pow(2,-10*(e-1)))})),c("Sine",u("SineOut",function(e){return Math.sin(e*s)}),u("SineIn",function(e){return 1-Math.cos(e*s)}),u("SineInOut",function(e){return-.5*(Math.cos(Math.PI*e)-1)})),l("easing.EaseLookup",{find:function(e){return g.map[e]}},!0),h(n.SlowMo,"SlowMo","ease,"),h(t,"RoughEase","ease,"),h(r,"SteppedEase","ease,"),p},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(f,p){"use strict";var d={},i=f.document,m=f.GreenSockGlobals=f.GreenSockGlobals||f,e=m[p];if(e)return"undefined"!=typeof module&&module.exports&&(module.exports=e);var t,r,n,g,v,o,a,_=function(e){var t,r=e.split("."),i=m;for(t=0;t=r&&ethis._duration?this._duration:e,t)):this._time},n.totalTime=function(e,t,r){if(v||g.wake(),!arguments.length)return this._totalTime;if(this._timeline){if(e<0&&!r&&(e+=this.totalDuration()),this._timeline.smoothChildTiming){this._dirty&&this.totalDuration();var i=this._totalDuration,n=this._timeline;if(io;)n=n._prev;return n?(e._next=n._next,n._next=e):(e._next=this._first,this._first=e),e._next?e._next._prev=e:this._last=e,e._prev=n,this._recent=e,this._timeline&&this._uncache(!0),this},n._remove=function(e,t){return e.timeline===this&&(t||e._enabled(!1,!0),e._prev?e._prev._next=e._next:this._first===e&&(this._first=e._next),e._next?e._next._prev=e._prev:this._last===e&&(this._last=e._prev),e._next=e._prev=e.timeline=null,e===this._recent&&(this._recent=this._last),this._timeline&&this._uncache(!0)),this},n.render=function(e,t,r){var i,n=this._first;for(this._totalTime=this._time=this._rawPrevTime=e;n;)i=n._next,(n._active||e>=n._startTime&&!n._paused&&!n._gc)&&(n._reversed?n.render((n._dirty?n.totalDuration():n._totalDuration)-(e-n._startTime)*n._timeScale,t,r):n.render((e-n._startTime)*n._timeScale,t,r)),n=i},n.rawTime=function(){return v||g.wake(),this._totalTime};var z=k("TweenLite",function(e,t,r){if(M.call(this,t,r),this.render=z.prototype.render,null==e)throw"Cannot tween a null target.";this.target=e="string"!=typeof e?e:z.selector(e)||e;var i,n,o,a=e.jquery||e.length&&e!==f&&e[0]&&(e[0]===f||e[0].nodeType&&e[0].style&&!e.nodeType),s=this.vars.overwrite;if(this._overwrite=s=null==s?J[z.defaultOverwrite]:"number"==typeof s?s>>0:J[s],(a||e instanceof Array||e.push&&x(e))&&"number"!=typeof e[0])for(this._targets=o=l(e),this._propLookup=[],this._siblings=[],i=0;i=$){for(r in $=g.frame+(parseInt(z.autoSleep,10)||120),V){for(e=(t=V[r].tweens).length;-1<--e;)t[e]._gc&&t.splice(e,1);0===t.length&&delete V[r]}if((!(r=Q._first)||r._paused)&&z.autoSleep&&!K._first&&1===g._listeners.tick.length){for(;r&&r._paused;)r=r._next;r||g.sleep()}}},g.addEventListener("tick",M._updateRoot);var te=function(e,t,r){var i,n,o=e._gsTweenID;if(V[o||(e._gsTweenID=o="t"+Y++)]||(V[o]={target:e,tweens:[]}),t&&((i=V[o].tweens)[n=i.length]=t,r))for(;-1<--n;)i[n]===t&&i.splice(n,1);return V[o].tweens},re=function(e,t,r,i){var n,o,a=e.vars.onOverwrite;return a&&(n=a(e,t,r,i)),(a=z.onOverwrite)&&(o=a(e,t,r,i)),!1!==n&&!1!==o},ie=function(e,t,r,i,n){var o,a,s,l;if(1===i||4<=i){for(l=n.length,o=0;oh&&((p||!s._initted)&&h-s._startTime<=2e-8||(c[f++]=s)));for(o=f;-1<--o;)if(l=(s=c[o])._firstPT,2===i&&s._kill(r,e,t)&&(a=!0),2!==i||!s._firstPT&&s._initted&&l){if(2!==i&&!re(s,t))continue;s._enabled(!1,!1)&&(a=!0)}return a},ne=function(e,t,r){for(var i=e._timeline,n=i._timeScale,o=e._startTime;i._timeline;){if(o+=i._startTime,n*=i._timeScale,i._paused)return-100;i=i._timeline}return t<(o/=n)?o-t:r&&o===t||!e._initted&&o-t<2e-8?y:(o+=e.totalDuration()/e._timeScale/n)>t+y?0:o-t-y};n._init=function(){var e,t,r,i,n,o,a=this.vars,s=this._overwrittenProps,l=this._duration,u=!!a.immediateRender,h=a.ease,c=this._startAt;if(a.startAt){for(i in c&&(c.render(-1,!0),c.kill()),n={},a.startAt)n[i]=a.startAt[i];if(n.data="isStart",n.overwrite=!1,n.immediateRender=!0,n.lazy=u&&!1!==a.lazy,n.startAt=n.delay=null,n.onUpdate=a.onUpdate,n.onUpdateParams=a.onUpdateParams,n.onUpdateScope=a.onUpdateScope||a.callbackScope||this,this._startAt=z.to(this.target||{},0,n),u)if(0s.pr;)i=i._next;(s._prev=i?i._prev:o)?s._prev._next=s:n=s,(s._next=i)?i._prev=s:o=s,s=a}s=t._firstPT=n}for(;s;)s.pg&&"function"==typeof s.t[e]&&s.t[e]()&&(r=!0),s=s._next;return r},oe.activate=function(e){for(var t=e.length;-1<--t;)e[t].API===oe.API&&(q[(new e[t])._propName]=e[t]);return!0},s.plugin=function(e){if(!(e&&e.propName&&e.init&&e.API))throw"illegal plugin definition.";var t,r=e.propName,i=e.priority||0,n=e.overwriteProps,o={init:"_onInitTween",set:"setRatio",kill:"_kill",round:"_mod",mod:"_mod",initAll:"_onInitAllProps"},a=k("plugins."+r.charAt(0).toUpperCase()+r.substr(1)+"Plugin",function(){oe.call(this,r,i),this._overwriteProps=n||[]},!0===e.global),s=a.prototype=new oe(r);for(t in(s.constructor=a).API=e.API,o)"function"==typeof e[t]&&(s[o[t]]=e[t]);return a.version=e.version,oe.activate([a]),a},t=f._gsQueue){for(r=0;r>0,f._cycle&&f._cycle===f._totalTime/l&&g<=e&&f._cycle--,f._time=f._totalTime-f._cycle*l,f._yoyo&&1&f._cycle&&(f._time=m-f._time),f._time>m?e=(f._time=m)+1e-4:f._time<0?f._time=e=0:e=f._time));if(f._hasPause&&!f._forcingPlayhead&&!t){if(p<(e=f._time)||f._repeat&&x!==f._cycle)for(i=f._first;i&&i._startTime<=e&&!u;)i._duration||"isPause"!==i.data||i.ratio||0===i._startTime&&0===f._rawPrevTime||(u=i),i=i._next;else for(i=f._last;i&&i._startTime>=e&&!u;)i._duration||"isPause"===i.data&&0f._time;)u.render(u._reversed?u.totalDuration()-(e-u._startTime)*u._timeScale:(e-u._startTime)*u._timeScale,t,r),u=u._prev;u=null,f.pause(),f._pauseTime=c}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}f._onUpdate&&(t||(C.length&&I(),f._callback("onUpdate"))),a&&(f._locked||f._gc||v!==f._startTime&&_===f._timeScale||(0===f._time||d>=f.totalDuration())&&(n&&(C.length&&I(),f._timeline.autoRemoveChildren&&f._enabled(!1,!1),f._active=!1),!t&&f.vars[a]&&f._callback(a)))}else g!==f._totalTime&&f._onUpdate&&(t||f._callback("onUpdate"))},n.getActive=function(e,t,r){var i,n,o=[],a=this.getChildren(e||null==e,t||null==e,!!r),s=0,l=a.length;for(i=0;ie)return r[t].name;return null},n.getLabelBefore=function(e){null==e&&(e=this._time);for(var t=this.getLabelsArray(),r=t.length;-1<--r;)if(t[r].timee._startTime;l._timeline;)u&&l._timeline.smoothChildTiming?l.totalTime(l._totalTime,!0):l._gc&&l._enabled(!0,!1),l=l._timeline;return h},r.remove=function(e){if(e instanceof c){this._remove(e,!1);var t=e._timeline=e.vars.useFrames?c._rootFramesTimeline:c._rootTimeline;return e._startTime=(e._paused?e._pauseTime:t._time)-(e._reversed?e.totalDuration()-e._totalTime:e._totalTime)/e._timeScale,this}if(e instanceof Array||e&&e.push&&p(e)){for(var r=e.length;-1<--r;)this.remove(e[r]);return this}return"string"==typeof e?this.removeLabel(e):this.kill(null,e)},r._remove=function(e,t){return f.prototype._remove.call(this,e,t),this._last?this._time>this.duration()&&(this._time=this._duration,this._totalTime=this._totalDuration):this._time=this._totalTime=this._duration=this._totalDuration=0,this},r.append=function(e,t){return this.add(e,this._parseTimeOrLabel(null,t,!0,e))},r.insert=r.insertMultiple=function(e,t,r,i){return this.add(e,t||0,r,i)},r.appendMultiple=function(e,t,r,i){return this.add(e,this._parseTimeOrLabel(null,t,!0,e),r,i)},r.addLabel=function(e,t){return this._labels[e]=this._parseTimeOrLabel(t),this},r.addPause=function(e,t,r,i){var n=d.delayedCall(0,o,r,i||this);return n.vars.onComplete=n.vars.onReverseComplete=t,n.data="isPause",this._hasPause=!0,this.add(n,e)},r.removeLabel=function(e){return delete this._labels[e],this},r.getLabelTime=function(e){return null!=this._labels[e]?this._labels[e]:-1},r._parseTimeOrLabel=function(e,t,r,i){var n,o;if(i instanceof c&&i.timeline===this)this.remove(i);else if(i&&(i instanceof Array||i.push&&p(i)))for(o=i.length;-1<--o;)i[o]instanceof c&&i[o].timeline===this&&this.remove(i[o]);if(n="number"!=typeof e||t?99999999999=e&&!l;)i._duration||"isPause"===i.data&&0c._time;)l.render(l._reversed?l.totalDuration()-(e-l._startTime)*l._timeScale:(e-l._startTime)*l._timeScale,t,r),l=l._prev;l=null,c.pause(),c._pauseTime=h}i._reversed?i.render((i._dirty?i.totalDuration():i._totalDuration)-(e-i._startTime)*i._timeScale,t,r):i.render((e-i._startTime)*i._timeScale,t,r)}i=o}c._onUpdate&&(t||(v.length&&_(),c._callback("onUpdate"))),a&&(c._gc||d!==c._startTime&&m===c._timeScale||(0===c._time||p>=c.totalDuration())&&(n&&(v.length&&_(),c._timeline.autoRemoveChildren&&c._enabled(!1,!1),c._active=!1),!t&&c.vars[a]&&c._callback(a)))}},r._hasPausedChild=function(){for(var e=this._first;e;){if(e._paused||e instanceof m&&e._hasPausedChild())return!0;e=e._next}return!1},r.getChildren=function(e,t,r,i){i=i||-9999999999;for(var n=[],o=this._first,a=0;o;)o._startTime=r&&(n._startTime+=e),n=n._next;if(t)for(i in o)o[i]>=r&&(o[i]+=e);return this._uncache(!0)},r._kill=function(e,t){if(!e&&!t)return this._enabled(!1,!1);for(var r=t?this.getTweensOf(t):this.getChildren(!0,!0,!1),i=r.length,n=!1;-1<--i;)r[i]._kill(e,t)&&(n=!0);return n},r.clear=function(e){var t=this.getChildren(!1,!0,!0),r=t.length;for(this._time=this._totalTime=0;-1<--r;)t[r]._enabled(!1,!1);return!1!==e&&(this._labels={}),this._uncache(!0)},r.invalidate=function(){for(var e=this._first;e;)e.invalidate(),e=e._next;return c.prototype.invalidate.call(this)},r._enabled=function(e,t){if(e===this._gc)for(var r=this._first;r;)r._enabled(e,!0),r=r._next;return f.prototype._enabled.call(this,e,t)},r.totalTime=function(e,t,r){this._forcingPlayhead=!0;var i=c.prototype.totalTime.apply(this,arguments);return this._forcingPlayhead=!1,i},r.duration=function(e){return arguments.length?(0!==this.duration()&&0!==e&&this.timeScale(this._duration/e),this):(this._dirty&&this.totalDuration(),this._duration)},r.totalDuration=function(e){if(arguments.length)return e&&this.totalDuration()?this.timeScale(this._totalDuration/e):this;if(this._dirty){for(var t,r,i=0,n=this,o=n._last,a=999999999999;o;)t=o._prev,o._dirty&&o.totalDuration(),o._startTime>a&&n._sortChildren&&!o._paused&&!n._calculatingDuration?(n._calculatingDuration=1,n.add(o,o._startTime-o._delay),n._calculatingDuration=0):a=o._startTime,o._startTime<0&&!o._paused&&(i-=o._startTime,n._timeline.smoothChildTiming&&(n._startTime+=o._startTime/n._timeScale,n._time-=o._startTime,n._totalTime-=o._startTime,n._rawPrevTime-=o._startTime),n.shiftChildren(-o._startTime,!1,-9999999999),a=0),i<(r=o._startTime+o._totalDuration/o._timeScale)&&(i=r),o=t;n._duration=n._totalDuration=i,n._dirty=!1}return this._totalDuration},r.paused=function(e){if(!1===e&&this._paused)for(var t=this._first;t;)t._startTime===this._time&&"isPause"===t.data&&(t._rawPrevTime=0),t=t._next;return c.prototype.paused.apply(this,arguments)},r.usesFrames=function(){for(var e=this._timeline;e._timeline;)e=e._timeline;return e===c._rootFramesTimeline},r.rawTime=function(e){return e&&(this._paused||this._repeat&&0+~]|"+L+")"+L+"*"),G=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),W=new RegExp(N),q=new RegExp("^"+F+"$"),V={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+j),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+z+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,J=/^[^{]+\{\s*\[native \w/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/[+~]/,$=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ee=function(e,t,r){var i="0x"+t-65536;return i!=i||r?t:i<0?String.fromCharCode(65536+i):String.fromCharCode(i>>10|55296,1023&i|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,re=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},ie=function(){w()},ne=_e(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{M.apply(t=D.call(_.childNodes),_.childNodes),t[_.childNodes.length].nodeType}catch(e){M={apply:t.length?function(e,t){O.apply(e,D.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}function oe(e,t,r,i){var n,o,a,s,l,u,h,c=t&&t.ownerDocument,f=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==f&&9!==f&&11!==f)return r;if(!i&&((t?t.ownerDocument||t:_)!==T&&w(t),t=t||T,k)){if(11!==f&&(l=K.exec(e)))if(n=l[1]){if(9===f){if(!(a=t.getElementById(n)))return r;if(a.id===n)return r.push(a),r}else if(c&&(a=c.getElementById(n))&&v(t,a)&&a.id===n)return r.push(a),r}else{if(l[2])return M.apply(r,t.getElementsByTagName(e)),r;if((n=l[3])&&p.getElementsByClassName&&t.getElementsByClassName)return M.apply(r,t.getElementsByClassName(n)),r}if(p.qsa&&!E[e+" "]&&(!g||!g.test(e))){if(1!==f)c=t,h=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(te,re):t.setAttribute("id",s=P),o=(u=d(e)).length;o--;)u[o]="#"+s+" "+ve(u[o]);h=u.join(","),c=Q.test(e)&&me(t.parentNode)||t}if(h)try{return M.apply(r,c.querySelectorAll(h)),r}catch(e){}finally{s===P&&t.removeAttribute("id")}}}return m(e.replace(U,"$1"),t,r,i)}function ae(){var i=[];return function e(t,r){return i.push(t+" ")>b.cacheLength&&delete e[i.shift()],e[t+" "]=r}}function se(e){return e[P]=!0,e}function le(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ue(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function he(e,t){var r=t&&e,i=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function ce(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function fe(r){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===r}}function pe(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ne(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function de(a){return se(function(o){return o=+o,se(function(e,t){for(var r,i=a([],e.length,o),n=i.length;n--;)e[r=i[n]]&&(e[r]=!(t[r]=e[r]))})})}function me(e){return e&&void 0!==e.getElementsByTagName&&e}for(e in p=oe.support={},n=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},w=oe.setDocument=function(e){var t,r,i=e?e.ownerDocument||e:_;return i!==T&&9===i.nodeType&&i.documentElement&&(a=(T=i).documentElement,k=!n(T),_!==T&&(r=T.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ie,!1):r.attachEvent&&r.attachEvent("onunload",ie)),p.attributes=le(function(e){return e.className="i",!e.getAttribute("className")}),p.getElementsByTagName=le(function(e){return e.appendChild(T.createComment("")),!e.getElementsByTagName("*").length}),p.getElementsByClassName=J.test(T.getElementsByClassName),p.getById=le(function(e){return a.appendChild(e).id=P,!T.getElementsByName||!T.getElementsByName(P).length}),p.getById?(b.filter.ID=function(e){var t=e.replace($,ee);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var r=e.replace($,ee);return function(e){var t=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===r}},b.find.ID=function(e,t){if(void 0!==t.getElementById&&k){var r,i,n,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(n=t.getElementsByName(e),i=0;o=n[i++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=p.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):p.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,i=[],n=0,o=t.getElementsByTagName(e);if("*"!==e)return o;for(;r=o[n++];)1===r.nodeType&&i.push(r);return i},b.find.CLASS=p.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&k)return t.getElementsByClassName(e)},s=[],g=[],(p.qsa=J.test(T.querySelectorAll))&&(le(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&g.push("[*^$]="+L+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||g.push("\\["+L+"*(?:value|"+z+")"),e.querySelectorAll("[id~="+P+"-]").length||g.push("~="),e.querySelectorAll(":checked").length||g.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||g.push(".#.+[+~]")}),le(function(e){e.innerHTML="";var t=T.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&g.push("name"+L+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&g.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(p.matchesSelector=J.test(h=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&le(function(e){p.disconnectedMatch=h.call(e,"*"),h.call(e,"[s!='']:x"),s.push("!=",N)}),g=g.length&&new RegExp(g.join("|")),s=s.length&&new RegExp(s.join("|")),t=J.test(a.compareDocumentPosition),v=t||J.test(a.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},A=t?function(e,t){if(e===t)return u=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!p.sortDetached&&t.compareDocumentPosition(e)===r?e===T||e.ownerDocument===_&&v(_,e)?-1:t===T||t.ownerDocument===_&&v(_,t)?1:l?R(l,e)-R(l,t):0:4&r?-1:1)}:function(e,t){if(e===t)return u=!0,0;var r,i=0,n=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!n||!o)return e===T?-1:t===T?1:n?-1:o?1:l?R(l,e)-R(l,t):0;if(n===o)return he(e,t);for(r=e;r=r.parentNode;)a.unshift(r);for(r=t;r=r.parentNode;)s.unshift(r);for(;a[i]===s[i];)i++;return i?he(a[i],s[i]):a[i]===_?-1:s[i]===_?1:0}),T},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==T&&w(e),t=t.replace(G,"='$1']"),p.matchesSelector&&k&&!E[t+" "]&&(!s||!s.test(t))&&(!g||!g.test(t)))try{var r=h.call(e,t);if(r||p.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,ee),e[3]=(e[3]||e[4]||e[5]||"").replace($,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&W.test(r)&&(t=d(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace($,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=f[e+" "];return t||(t=new RegExp("(^|"+L+")"+e+"("+L+"|$)"))&&f(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(r,i,n){return function(e){var t=oe.attr(e,r);return null==t?"!="===i:!i||(t+="","="===i?t===n:"!="===i?t!==n:"^="===i?n&&0===t.indexOf(n):"*="===i?n&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function C(e,r,i){return _(r)?P.grep(e,function(e,t){return!!r.call(e,t,e)!==i}):r.nodeType?P.grep(e,function(e){return e===r!==i}):"string"!=typeof r?P.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(P.fn.init=function(e,t,r){var i,n;if(!e)return this;if(r=r||I,"string"!=typeof e)return e.nodeType?(this[0]=e,this.length=1,this):_(e)?void 0!==r.ready?r.ready(e):e(P):P.makeArray(e,this);if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:O.exec(e))||!i[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof P?t[0]:t,P.merge(this,P.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:k,!0)),A.test(i[1])&&P.isPlainObject(t))for(i in t)_(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(n=k.getElementById(i[2]))&&(this[0]=n,this.length=1),this}).prototype=P.fn,I=P(k);var M=/^(?:parents|prev(?:Until|All))/,D={children:!0,contents:!0,next:!0,prev:!0};function R(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}P.fn.extend({has:function(e){var t=P(e,this),r=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ce={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function fe(e,t){var r;return r=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&E(e,t)?P.merge([e],r):r}function pe(e,t){for(var r=0,i=e.length;rx",v.noCloneChecked=!!de.cloneNode(!0).lastChild.defaultValue;var _e=k.documentElement,ye=/^key/,be=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,xe=/^([^.]*)(?:\.(.+)|)/;function we(){return!0}function Te(){return!1}function ke(){try{return k.activeElement}catch(e){}}function Pe(e,t,r,i,n,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof r&&(i=i||r,r=void 0),t)Pe(e,s,r,i,t[s],o);return e}if(null==i&&null==n?(n=r,i=r=void 0):null==n&&("string"==typeof r?(n=i,i=void 0):(n=i,i=r,r=void 0)),!1===n)n=Te;else if(!n)return e;return 1===o&&(a=n,(n=function(e){return P().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=P.guid++)),e.each(function(){P.event.add(this,t,n,i,r)})}P.event={global:{},add:function(t,e,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.get(t);if(g)for(r.handler&&(r=(o=r).handler,n=o.selector),n&&P.find.matchesSelector(_e,n),r.guid||(r.guid=P.guid++),(l=g.events)||(l=g.events={}),(a=g.handle)||(a=g.handle=function(e){return void 0!==P&&P.event.triggered!==e.type?P.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(z)||[""]).length;u--;)p=m=(s=xe.exec(e[u])||[])[1],d=(s[2]||"").split(".").sort(),p&&(c=P.event.special[p]||{},p=(n?c.delegateType:c.bindType)||p,c=P.event.special[p]||{},h=P.extend({type:p,origType:m,data:i,handler:r,guid:r.guid,selector:n,needsContext:n&&P.expr.match.needsContext.test(n),namespace:d.join(".")},o),(f=l[p])||((f=l[p]=[]).delegateCount=0,c.setup&&!1!==c.setup.call(t,i,d,a)||t.addEventListener&&t.addEventListener(p,a)),c.add&&(c.add.call(t,h),h.handler.guid||(h.handler.guid=r.guid)),n?f.splice(f.delegateCount++,0,h):f.push(h),P.event.global[p]=!0)},remove:function(e,t,r,i,n){var o,a,s,l,u,h,c,f,p,d,m,g=Z.hasData(e)&&Z.get(e);if(g&&(l=g.events)){for(u=(t=(t||"").match(z)||[""]).length;u--;)if(p=m=(s=xe.exec(t[u])||[])[1],d=(s[2]||"").split(".").sort(),p){for(c=P.event.special[p]||{},f=l[p=(i?c.delegateType:c.bindType)||p]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=f.length;o--;)h=f[o],!n&&m!==h.origType||r&&r.guid!==h.guid||s&&!s.test(h.namespace)||i&&i!==h.selector&&("**"!==i||!h.selector)||(f.splice(o,1),h.selector&&f.delegateCount--,c.remove&&c.remove.call(e,h));a&&!f.length&&(c.teardown&&!1!==c.teardown.call(e,d,g.handle)||P.removeEvent(e,p,g.handle),delete l[p])}else for(p in l)P.event.remove(e,p+t[u],r,i,!0);P.isEmptyObject(l)&&Z.remove(e,"handle events")}},dispatch:function(e){var t,r,i,n,o,a,s=P.event.fix(e),l=new Array(arguments.length),u=(Z.get(this,"events")||{})[s.type]||[],h=P.event.special[s.type]||{};for(l[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,Ee=/\s*$/g;function Ie(e,t){return E(e,"table")&&E(11!==t.nodeType?t:t.firstChild,"tr")&&P(e).children("tbody")[0]||e}function Oe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Me(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var r,i,n,o,a,s,l,u;if(1===t.nodeType){if(Z.hasData(e)&&(o=Z.access(e),a=Z.set(t,o),u=o.events))for(n in delete a.handle,a.events={},u)for(r=0,i=u[n].length;r")},clone:function(e,t,r){var i,n,o,a,s,l,u,h=e.cloneNode(!0),c=P.contains(e.ownerDocument,e);if(!(v.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||P.isXMLDoc(e)))for(a=fe(h),i=0,n=(o=fe(e)).length;i").prop({charset:r.scriptCharset,src:r.url}).on("load error",n=function(e){i.remove(),n=null,e&&t("error"===e.type?404:200,e.type)}),k.head.appendChild(i[0])},abort:function(){n&&n()}}});var Xt,Ht=[],Gt=/(=)\?(?=&|$)|\?\?/;P.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Ht.pop()||P.expando+"_"+bt++;return this[e]=!0,e}}),P.ajaxPrefilter("json jsonp",function(e,t,r){var i,n,o,a=!1!==e.jsonp&&(Gt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Gt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return i=e.jsonpCallback=_(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Gt,"$1"+i):!1!==e.jsonp&&(e.url+=(xt.test(e.url)?"&":"?")+e.jsonp+"="+i),e.converters["script json"]=function(){return o||P.error(i+" was not called"),o[0]},e.dataTypes[0]="json",n=T[i],T[i]=function(){o=arguments},r.always(function(){void 0===n?P(T).removeProp(i):T[i]=n,e[i]&&(e.jsonpCallback=t.jsonpCallback,Ht.push(i)),o&&_(n)&&n(o[0]),o=n=void 0}),"script"}),v.createHTMLDocument=((Xt=k.implementation.createHTMLDocument("").body).innerHTML="
",2===Xt.childNodes.length),P.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(v.createHTMLDocument?((i=(t=k.implementation.createHTMLDocument("")).createElement("base")).href=k.location.href,t.head.appendChild(i)):t=k),o=!r&&[],(n=A.exec(e))?[t.createElement(n[1])]:(n=ve([e],t,o),o&&o.length&&P(o).remove(),P.merge([],n.childNodes)));var i,n,o},P.fn.load=function(e,t,r){var i,n,o,a=this,s=e.indexOf(" ");return-1").append(P.parseHTML(e)).find(i):e)}).always(r&&function(e,t){a.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},P.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){P.fn[t]=function(e){return this.on(t,e)}}),P.expr.pseudos.animated=function(t){return P.grep(P.timers,function(e){return t===e.elem}).length},P.offset={setOffset:function(e,t,r){var i,n,o,a,s,l,u=P.css(e,"position"),h=P(e),c={};"static"===u&&(e.style.position="relative"),s=h.offset(),o=P.css(e,"top"),l=P.css(e,"left"),n=("absolute"===u||"fixed"===u)&&-1<(o+l).indexOf("auto")?(a=(i=h.position()).top,i.left):(a=parseFloat(o)||0,parseFloat(l)||0),_(t)&&(t=t.call(e,r,P.extend({},s))),null!=t.top&&(c.top=t.top-s.top+a),null!=t.left&&(c.left=t.left-s.left+n),"using"in t?t.using.call(e,c):h.css(c)}},P.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){P.offset.setOffset(this,t,e)});var e,r,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),r=i.ownerDocument.defaultView,{top:e.top+r.pageYOffset,left:e.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,i=this[0],n={top:0,left:0};if("fixed"===P.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),r=i.ownerDocument,e=i.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===P.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((n=P(e).offset()).top+=P.css(e,"borderTopWidth",!0),n.left+=P.css(e,"borderLeftWidth",!0))}return{top:t.top-n.top-P.css(i,"marginTop",!0),left:t.left-n.left-P.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===P.css(e,"position");)e=e.offsetParent;return e||_e})}}),P.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,n){var o="pageYOffset"===n;P.fn[t]=function(e){return X(this,function(e,t,r){var i;if(y(e)?i=e:9===e.nodeType&&(i=e.defaultView),void 0===r)return i?i[n]:e[t];i?i.scrollTo(o?i.pageXOffset:r,o?r:i.pageYOffset):e[t]=r},t,e,arguments.length)}}),P.each(["top","left"],function(e,r){P.cssHooks[r]=Be(v.pixelPosition,function(e,t){if(t)return t=Ne(e,r),Le.test(t)?P(e).position()[r]+"px":t})}),P.each({Height:"height",Width:"width"},function(a,s){P.each({padding:"inner"+a,content:s,"":"outer"+a},function(i,o){P.fn[o]=function(e,t){var r=arguments.length&&(i||"boolean"!=typeof e),n=i||(!0===e||!0===t?"margin":"border");return X(this,function(e,t,r){var i;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(i=e.documentElement,Math.max(e.body["scroll"+a],i["scroll"+a],e.body["offset"+a],i["offset"+a],i["client"+a])):void 0===r?P.css(e,t,n):P.style(e,t,r,n)},s,r?e:void 0,r)}})}),P.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,r){P.fn[r]=function(e,t){return 0>>0,i=(r*=i)>>>0,i+=4294967296*(r-=i)}return 2.3283064365386963e-10*(i>>>0)}}();t.next=function(){var e=2091639*t.s0+2.3283064365386963e-10*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=r(" "),t.s1=r(" "),t.s2=r(" "),t.s0-=r(e),t.s0<0&&(t.s0+=1),t.s1-=r(e),t.s1<0&&(t.s1+=1),t.s2-=r(e),t.s2<0&&(t.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function i(e,t){var r=new o(e),i=t&&t.state,n=r.next;return n.int32=function(){return 4294967296*r.next()|0},n.double=function(){return n()+11102230246251565e-32*(2097152*n()|0)},n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.alea=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],16:[function(e,t,r){!function(e,t,r){function o(e){var n=this,t="";n.next=function(){var e=n.b,t=n.c,r=n.d,i=n.a;return e=e<<25^e>>>7^t,t=t-r|0,r=r<<24^r>>>8^i,i=i-e|0,n.b=e=e<<20^e>>>12^t,n.c=t=t-r|0,n.d=r<<16^t>>>16^i,n.a=i-e|0},n.a=0,n.b=0,n.c=-1640531527,n.d=1367130551,e===Math.floor(e)?(n.a=e/4294967296|0,n.b=0|e):t+=e;for(var r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.tychei=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],17:[function(e,t,r){!function(e,t,r){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var i=0;i>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor128=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],18:[function(e,t,r){!function(e,t,r){function o(e){var o=this;o.next=function(){var e,t,r=o.w,i=o.X,n=o.i;return o.w=r=r+1640531527|0,t=i[n+34&127],e=i[n=n+1&127],t^=t<<13,e^=e<<17,t^=t>>>15,e^=e>>>12,t=i[n]=t^e,o.i=n,t+(r^r>>>16)|0},function(e,t){var r,i,n,o,a,s=[],l=128;for(t===(0|t)?(i=t,t=null):(t+="\0",i=0,l=Math.max(l,t.length)),n=0,o=-32;o>>15,i^=i<<4,i^=i>>>13,0<=o&&(a=a+1640531527|0,n=0==(r=s[127&o]^=i+a)?n+1:0);for(128<=n&&(s[127&(t&&t.length||0)]=-1),n=127,o=512;0>>15,r^=r>>>12,s[n]=i^r;e.w=a,e.X=s,e.i=n}(o,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function i(e,t){null==e&&(e=+new Date);var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.X&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xor4096=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],19:[function(e,t,r){!function(e,t,r){function o(e){var n=this;n.next=function(){var e,t,r=n.x,i=n.i;return e=r[i],t=(e^=e>>>7)^e<<24,t^=(e=r[i+1&7])^e>>>10,t^=(e=r[i+3&7])^e>>>3,t^=(e=r[i+4&7])^e<<7,e=r[i+7&7],t^=(e^=e<<13)^e<<9,r[i]=t,n.i=i+1&7,t},function(e,t){var r,i=[];if(t===(0|t))i[0]=t;else for(t=""+t,r=0;r>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&(i.x&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorshift7=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],20:[function(e,t,r){!function(e,t,r){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,e===((t.v=0)|e)?t.x=e:r+=e;for(var i=0;i>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function i(e,t){var r=new o(e),i=t&&t.state,n=function(){return(r.next()>>>0)/4294967296};return n.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},n.int32=r.next,n.quick=n,i&&("object"==typeof i&&a(i,r),n.state=function(){return a(r,{})}),n}t&&t.exports?t.exports=i:r&&r.amd?r(function(){return i}):this.xorwow=i}(0,"object"==typeof t&&t,"function"==typeof define&&define)},{}],21:[function(t,r,e){!function(s,l){var u,h=this,c=256,f=6,p="random",d=l.pow(c,f),m=l.pow(2,52),g=2*m,v=c-1;function e(e,t,r){var i=[],n=b(function e(t,r){var i,n=[],o=typeof t;if(r&&"object"==o)for(i in t)try{n.push(e(t[i],r-1))}catch(e){}return n.length?n:"string"==o?t:t+"\0"}((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(s)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(c):(e=new Uint8Array(c),(h.crypto||h.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=h.navigator,r=t&&t.plugins;return[+new Date,h,r,h.screen,x(s)]}}():e,3),i),o=new _(i),a=function(){for(var e=o.g(f),t=d,r=0;e>>=1;return(e+r)/t};return a.int32=function(){return 0|o.g(4)},a.quick=function(){return o.g(4)/4294967296},a.double=a,b(x(o.S),s),(t.pass||r||function(e,t,r,i){return i&&(i.S&&y(i,o),e.state=function(){return y(o,{})}),r?(l[p]=e,t):e})(a,n,"global"in t?t.global:this==l,t.state)}function _(e){var t,r=e.length,a=this,i=0,n=a.i=a.j=0,o=a.S=[];for(r||(e=[r++]);iMath.PI?c-r:r}function g(e){return e-c*Math.floor(e/c)}t.exports={UP:o,DOWN:a,LEFT:s,RIGHT:0,NORTH:l,SOUTH:u,WEST:h,EAST:0,PI_2:c,PI_QUARTER:f,PI_HALF:p,toDegrees:function(e){return e*i},toRadians:function(e){return e*n},isAngleBetween:function(e,t,r){if(((r-t)%c+c)%c>=Math.PI){var i=t;t=r,r=i}return t<=r?t<=e&&e<=r:t<=e||e<=r},differenceAnglesSign:d,differenceAngles:m,shortestAngle:function(e,t){return m(t,e)*d(t,e)+e},normalize:g,angleTwoPoints:function(){return 4===arguments.length?Math.atan2(arguments[3]-arguments[1],arguments[2]-arguments[0]):Math.atan2(arguments[1].y-arguments[0].y,arguments[1].x-arguments[0].x)},distanceTwoPoints:function(){return 2===arguments.length?Math.sqrt(Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2)):Math.sqrt(Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2))},distanceTwoPointsSquared:function(){return 2===arguments.length?Math.pow(arguments[1].x-arguments[0].x,2)+Math.pow(arguments[1].y-arguments[0].y,2):Math.pow(arguments[2]-arguments[0],2)+Math.pow(arguments[3]-arguments[1],2)},closestAngle:function(e){var t=m(e,s),r=m(e,0),i=m(e,o),n=m(e,a);return t<=r&&t<=i&&t<=n?s:r<=i&&r<=n?0:i<=n?o:a},equals:function(e,t,r){return r?m(e,t)>16)+e*(r>>16)<<16|i*(t>>8&255)+e*(r>>8&255)<<8|i*(255&t)+e*(255&r)},random:function(e,t){function r(){return s.range(e,t)}var i=s.pick([{r:1,g:1,b:1},{r:1,g:1,b:0},{r:1,g:0,b:1},{r:0,g:1,b:1},{r:1,g:0,b:0},{r:0,g:1,b:0},{r:0,g:0,b:1}]);return e=e||0,t=t||255,this.rgbToHex(i.r?r():0,i.g?r():0,i.b?r():0)},randomHSL:function(e,t,r,i,n,o){var a={h:s.range(e,t),s:s.range(r,i,!0),l:s.range(n,o,!0)};return this.hslToHex(a)},randomGoldenRatioHSL:function(e,t,r){for(var i=s.get(1,!0),n=[],o=0;o=this.time?(this.parent.x=t.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(t.time,t.start,t.delta,this.time),this.parent.dirty=!0}if(this.toY){var r=this.toY;r.time+=e,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),r.time>=this.time?(this.parent.y=r.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(r.time,r.start,r.delta,this.time),this.parent.dirty=!0}}}},{key:"calcUnderflowX",value:function(){var e=void 0;switch(this.underflowX){case-1:e=0;break;case 1:e=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:e=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return e}},{key:"calcUnderflowY",value:function(){var e=void 0;switch(this.underflowY){case-1:e=0;break;case 1:e=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:e=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return e}},{key:"bounce",value:function(){if(!this.paused){var e=void 0,t=this.parent.plugins.decelerate;t&&(t.x||t.y)&&(t.x&&t.percentChangeX===t.friction||t.y&&t.percentChangeY===t.friction)&&(((e=this.parent.OOB()).left&&this.left||e.right&&this.right)&&(t.percentChangeX=this.friction),(e.top&&this.top||e.bottom&&this.bottom)&&(t.percentChangeY=this.friction));var r=this.parent.plugins.drag||{},i=this.parent.plugins.pinch||{};if(t=t||{},!(r.active||i.active||this.toX&&this.toY||t.x&&t.y)){var n=(e=e||this.parent.OOB()).cornerPoint;if(!this.toX&&!t.x){var o=null;e.left&&this.left?o=this.parent.screenWorldWidththis.maxWidth&&(this.parent.fitWidth(this.maxWidth),e=this.parent.worldScreenWidth,t=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})),this.minHeight&&tthis.maxHeight&&(this.parent.fitHeight(this.maxHeight),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}]),i}()},{"./plugin":9}],3:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r(!0===this.right?this.parent.worldWidth:this.right)&&(this.parent.x=-(!0===this.right?this.parent.worldWidth:this.right)*this.parent.scale.x+this.parent.screenWidth,t=!(e.x=0));t&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-x"})}if(null!==this.top||null!==this.bottom){var r=void 0;if(this.parent.screenWorldHeight(!0===this.bottom?this.parent.worldHeight:this.bottom)&&(this.parent.y=-(!0===this.bottom?this.parent.worldHeight:this.bottom)*this.parent.scale.y+this.parent.screenHeight,r=!(e.y=0));r&&this.parent.emit("moved",{viewport:this.parent,type:"clamp-y"})}}}}]),i}()},{"./plugin":9,"./utils":12}],4:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=e-100){var s=e-a.time;this.x=(this.parent.x-a.x)/s,this.y=(this.parent.y-a.y)/s,this.percentChangeX=this.percentChangeY=this.friction;break}}}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}}}},{key:"activate",value:function(e){void 0!==(e=e||{}).x&&(this.x=e.x,this.percentChangeX=this.friction),void 0!==e.y&&(this.y=e.y,this.percentChangeY=this.friction)}},{key:"update",value:function(e){if(!this.paused){var t=void 0;this.x&&(this.parent.x+=this.x*e,this.x*=this.percentChangeX,Math.abs(this.x)this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,e.x=0);if("x"!==this.clampWheel)if(this.parent.screenWorldHeightthis.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,e.y=0)}},{key:"active",get:function(){return this.moved}}]),i}()},{"./plugin":9,"./utils":12}],6:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.radius))return;var i=Math.atan2(this.target.y-e.y,this.target.x-e.x);t=this.target.x-Math.cos(i)*this.radius,r=this.target.y-Math.sin(i)*this.radius}if(this.speed){var n=t-e.x,o=r-e.y;if(n||o){var a=Math.atan2(r-e.y,t-e.x),s=Math.cos(a)*this.speed,l=Math.sin(a)*this.speed,u=Math.abs(s)>Math.abs(n)?t:e.x+s,h=Math.abs(l)>Math.abs(o)?r:e.y+l;this.parent.moveCenter(u,h),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else this.parent.moveCenter(t,r),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}}]),n}()},{"./plugin":9}],7:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.radiusSquared){var n=Math.atan2(i.y-r,i.x-t);this.linear?(this.horizontal=Math.round(Math.cos(n))*this.speed*this.reverse*.06,this.vertical=Math.round(Math.sin(n))*this.speed*this.reverse*.06):(this.horizontal=Math.cos(n)*this.speed*this.reverse*.06,this.vertical=Math.sin(n)*this.speed*this.reverse*.06)}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else o.exists(this.left)&&tthis.right?this.horizontal=-1*this.reverse*this.speed*.06:(this.decelerateHorizontal(),this.horizontal=0),o.exists(this.top)&&rthis.bottom?this.vertical=-1*this.reverse*this.speed*.06:(this.decelerateVertical(),this.vertical=0)}}},{key:"decelerateHorizontal",value:function(){var e=this.parent.plugins.decelerate;this.horizontal&&e&&!this.noDecelerate&&e.activate({x:this.horizontal*this.speed*this.reverse/(1e3/60)})}},{key:"decelerateVertical",value:function(){var e=this.parent.plugins.decelerate;this.vertical&&e&&!this.noDecelerate&&e.activate({y:this.vertical*this.speed*this.reverse/(1e3/60)})}},{key:"up",value:function(){this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null}},{key:"update",value:function(){if(!this.paused&&(this.horizontal||this.vertical)){var e=this.parent.center;this.horizontal&&(e.x+=this.horizontal*this.speed),this.vertical&&(e.y+=this.vertical*this.speed),this.parent.moveCenter(e),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}]),i}()},{"./plugin":9,"./utils":12}],8:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;r=this.time)this.parent.scale.set(this.x_scale,this.y_scale),this.removeOnComplete&&this.parent.removePlugin("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{var i=this.snapping;this.parent.scale.x=this.ease(i.time,i.startX,i.deltaX,this.time),this.parent.scale.y=this.ease(i.time,i.startY,i.deltaY,this.time)}var n=this.parent.plugins["clamp-zoom"];n&&n.clamp(),this.noMove||(this.center?this.parent.moveCenter(this.center):this.parent.moveCenter(t))}}else this.parent.scale.x===this.x_scale&&this.parent.scale.y===this.y_scale||this.createSnapping()}}},{key:"resume",value:function(){this.snapping=null,function e(t,r,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,r);if(void 0===n){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,i)}if("value"in n)return n.value;var a=n.get;return void 0!==a?a.call(i):void 0}(i.prototype.__proto__||Object.getPrototypeOf(i.prototype),"resume",this).call(this)}}]),i}()},{"./plugin":9,"./utils":12}],11:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;rthis.time)r=!0,i=this.startX+this.deltaX,n=this.startY+this.deltaY;else{var o=this.ease(t.time,0,1,this.time);i=this.startX+this.deltaX*o,n=this.startY+this.deltaY*o}this.topLeft?this.parent.moveCorner(i,n):this.parent.moveCenter(i,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),r&&(this.removeOnComplete&&this.parent.removePlugin("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{var a=this.topLeft?this.parent.corner:this.parent.center;a.x===this.x&&a.y===this.y||this.snapStart()}}}]),o}()},{"./plugin":9,"./utils":12}],12:[function(e,t,r){"use strict";var i=e("penner");function n(e){return null!=e}t.exports={exists:n,defaults:function(e,t){return null!=e?e:t},ease:function(e,t){return n(e)?"function"==typeof e?e:"string"==typeof e?i[e]:void 0:i[t]}}},{penner:15}],13:[function(e,t,r){"use strict";var i=function(){function i(e,t){for(var r=0;r=this.threshold}},{key:"move",value:function(e){if(!this.pause){var t=!0,r=!1,i=void 0;try{for(var n,o=this.pluginsList[Symbol.iterator]();!(t=(n=o.next()).done);t=!0){n.value.move(e)}}catch(e){r=!0,i=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw i}}if(this.clickedAvailable){var a=e.data.global.x-this.last.x,s=e.data.global.y-this.last.y;(this.checkThreshold(a)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}}}},{key:"up",value:function(e){if(!this.pause){if(e.data.originalEvent instanceof MouseEvent&&0==e.data.originalEvent.button&&(this.leftDown=!1),"mouse"!==e.data.pointerType)for(var t=0;tthis._worldWidth,e.top=this.top<0,e.bottom=this.bottom>this._worldHeight,e.cornerPoint={x:this._worldWidth*this.scale.x-this._screenWidth,y:this._worldHeight*this.scale.y-this._screenHeight},e}},{key:"countDownPointers",value:function(){return(this.leftDown?1:0)+this.touches.length}},{key:"getTouchPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t){var i=t[r];-1!==this.touches.indexOf(i.pointerId)&&e.push(i)}return e}},{key:"getPointers",value:function(){var e=[],t=this.trackedPointers;for(var r in t)e.push(t[r]);return e}},{key:"_reset",value:function(){this.plugins.bounce&&(this.plugins.bounce.reset(),this.plugins.bounce.bounce()),this.plugins.decelerate&&this.plugins.decelerate.reset(),this.plugins.snap&&this.plugins.snap.reset(),this.plugins.clamp&&this.plugins.clamp.update(),this.plugins["clamp-zoom"]&&this.plugins["clamp-zoom"].clamp(),this.dirty=!0}},{key:"removePlugin",value:function(e){this.plugins[e]&&(this.plugins[e]=null,this.emit(e+"-remove"),this.pluginsSort())}},{key:"pausePlugin",value:function(e){this.plugins[e]&&this.plugins[e].pause()}},{key:"resumePlugin",value:function(e){this.plugins[e]&&this.plugins[e].resume()}},{key:"pluginsSort",value:function(){var e=!0,t=!(this.pluginsList=[]),r=void 0;try{for(var i,n=g[Symbol.iterator]();!(e=(i=n.next()).done);e=!0){var o=i.value;this.plugins[o]&&this.pluginsList.push(this.plugins[o])}}catch(e){t=!0,r=e}finally{try{!e&&n.return&&n.return()}finally{if(t)throw r}}}},{key:"drag",value:function(e){return this.plugins.drag=new o(this,e),this.pluginsSort(),this}},{key:"clamp",value:function(e){return this.plugins.clamp=new s(this,e),this.pluginsSort(),this}},{key:"decelerate",value:function(e){return this.plugins.decelerate=new u(this,e),this.pluginsSort(),this}},{key:"bounce",value:function(e){return this.plugins.bounce=new h(this,e),this.pluginsSort(),this}},{key:"pinch",value:function(e){return this.plugins.pinch=new a(this,e),this.pluginsSort(),this}},{key:"snap",value:function(e,t,r){return this.plugins.snap=new c(this,e,t,r),this.pluginsSort(),this}},{key:"follow",value:function(e,t){return this.plugins.follow=new p(this,e,t),this.pluginsSort(),this}},{key:"wheel",value:function(e){return this.plugins.wheel=new d(this,e),this.pluginsSort(),this}},{key:"clampZoom",value:function(e){return this.plugins["clamp-zoom"]=new l(this,e),this.pluginsSort(),this}},{key:"mouseEdges",value:function(e){return this.plugins["mouse-edges"]=new m(this,e),this.pluginsSort(),this}},{key:"screenWidth",get:function(){return this._screenWidth},set:function(e){this._screenWidth=e}},{key:"screenHeight",get:function(){return this._screenHeight},set:function(e){this._screenHeight=e}},{key:"worldWidth",get:function(){return this._worldWidth?this._worldWidth:this.width},set:function(e){this._worldWidth=e,this.resizePlugins()}},{key:"worldHeight",get:function(){return this._worldHeight?this._worldHeight:this.height},set:function(e){this._worldHeight=e,this.resizePlugins()}},{key:"worldScreenWidth",get:function(){return this._screenWidth/this.scale.x}},{key:"worldScreenHeight",get:function(){return this._screenHeight/this.scale.y}},{key:"screenWorldWidth",get:function(){return this._worldWidth*this.scale.x}},{key:"screenWorldHeight",get:function(){return this._worldHeight*this.scale.y}},{key:"center",get:function(){return{x:this.worldScreenWidth/2-this.x/this.scale.x,y:this.worldScreenHeight/2-this.y/this.scale.y}},set:function(e){this.moveCenter(e)}},{key:"corner",get:function(){return{x:-this.x/this.scale.x,y:-this.y/this.scale.y}},set:function(e){this.moveCorner(e)}},{key:"right",get:function(){return-this.x/this.scale.x+this.worldScreenWidth},set:function(e){this.x=-e*this.scale.x+this.screenWidth,this._reset()}},{key:"left",get:function(){return-this.x/this.scale.x},set:function(e){this.x=-e*this.scale.x,this._reset()}},{key:"top",get:function(){return-this.y/this.scale.y},set:function(e){this.y=-e*this.scale.y,this._reset()}},{key:"bottom",get:function(){return-this.y/this.scale.y+this.worldScreenHeight},set:function(e){this.y=-e*this.scale.y+this.screenHeight,this._reset()}},{key:"dirty",get:function(){return this._dirty},set:function(e){this._dirty=e}},{key:"forceHitArea",get:function(){return this._forceHitArea},set:function(e){e?(this._forceHitArea=e,this.hitArea=e):(this._forceHitArea=!1,this.hitArea=new PIXI.Rectangle(0,0,this.worldWidth,this.worldHeight))}},{key:"pause",get:function(){return this._pause},set:function(e){(this._pause=e)&&(this.touches=[],this.leftDown=!1)}}]),r}();PIXI.extras.Viewport=v,t.exports=v},{"./bounce":1,"./clamp":3,"./clamp-zoom":2,"./decelerate":4,"./drag":5,"./follow":6,"./mouse-edges":7,"./pinch":8,"./snap":11,"./snap-zoom":10,"./utils":12,"./wheel":14}],14:[function(e,t,r){"use strict";var n=function(){function i(e,t){for(var r=0;rt&&(r[i]=this.hyphenate(r[i]).join("­"));return r.join("")},t.prototype.hyphenate=function(e){var t,r,i,n,o,a,s,l,u,h=[],c=[],f=e.toLowerCase(),p=Math.max,d=this.trie,m=[""];if(this.exceptions.hasOwnProperty(f))return e.match(this.exceptions[f]).slice(1);if(-1!==e.indexOf("­"))return[e];for(t=(e="_"+e+"_").toLowerCase().split(""),r=e.split(""),s=t.length,i=0;ithis.leftMin&&i { - if (typeof(event.error) == 'undefined') { + if (typeof event.error == 'undefined') { // This sometimes happens in Edge. Since we have no error // position, we cannot do much beside an info log. - console.info("Catched undefined error", event); + console.info('Catched undefined error', event); return } this.appendError(event.error, event.filename); @@ -870,7 +870,7 @@ return new Date(date.getTime() + 1) } - static * iterYears(start, end) { + static *iterYears(start, end) { let date = this.create(start.getFullYear(), 0, 1); while (date <= end) { yield date; @@ -879,7 +879,7 @@ yield date; } - static * iterMonths(year, limit = 12) { + static *iterMonths(year, limit = 12) { let month = 0; while (month < limit) { let date = this.create(year.getFullYear(), month, 1); @@ -888,7 +888,7 @@ } } - static * iterMonthsOfYears(years) { + static *iterMonthsOfYears(years) { for (let year of years) { for (let month of this.iterMonths(year)) { yield month; @@ -896,7 +896,7 @@ } } - static * iterDays(month) { + static *iterDays(month) { let day = 1; let limit = Dates.daysInMonth(month); while (day <= limit) { @@ -906,7 +906,7 @@ } } - static * iterDaysOfMonths(months) { + static *iterDaysOfMonths(months) { for (let month of months) { for (let day of this.iterDays(month)) { yield day; @@ -1084,16 +1084,12 @@ static distanceToRect(p, r) { let dx = 0; let dy = 0; - if (p.x < r.x) - dx = p.x - r.x; - else if (p.x > r.x + r.width) - dx = p.x - (r.x + r.width); - if (p.y < r.y) - dy = p.y - r.y; - else if (p.y > r.y + r.height) - dy = p.y - (r.y + r.height); + if (p.x < r.x) dx = p.x - r.x; + else if (p.x > r.x + r.width) dx = p.x - (r.x + r.width); + if (p.y < r.y) dy = p.y - r.y; + else if (p.y > r.y + r.height) dy = p.y - (r.y + r.height); return Math.sqrt(dx * dx + dy * dy) - /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) + /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) let cy = Math.max(Math.min(p.y, r.y + r.height), r.y) let result = Math.sqrt((p.x - cx) * (p.x - cx) + (p.y - cy) * (p.y - cy)) console.log("distanceToRect", p, r, result) @@ -1137,8 +1133,7 @@ const i = sets.reduce((m, s, i) => (s.size < sets[m].size ? i : m), 0); const [smallest] = sets.splice(i, 1); const res = new Set(); - for (let val of smallest) - if (sets.every(s => s.has(val))) res.add(val); + for (let val of smallest) if (sets.every(s => s.has(val))) res.add(val); return res } @@ -1687,11 +1682,11 @@ next(nextValue) { // push new value to the end, and remove oldest one let removed = this.__push(nextValue); - // smooth value using all values from buffer + // smooth value using all values from buffer let result = this.buffer.reduce((last, current) => { - return this.smoothing * current + (1 - this.smoothing) * last - }, removed); - // replace smoothed value + return this.smoothing * current + (1 - this.smoothing) * last + }, removed); + // replace smoothed value this.buffer[this.buffer.length - 1] = result; return result } @@ -3572,7 +3567,7 @@ // UO: since keepOnStage is called in nextVelocity we need to // ensure a return value if (!stagePolygon) return { x: 0, y: 0 } - let polygon = this.polygon; + this.polygon; let bounced = this.bouncing(); if (bounced) { let stage = this.containerBounds; @@ -4658,7 +4653,7 @@ isClickable(node) { if (node == null) return false - // console.log("isClickable", node, this.isClickPrevented(node)) + // console.log("isClickable", node, this.isClickPrevented(node)) if (this.isClickPrevented(node)) { return false } @@ -4705,8 +4700,8 @@ let clickRects = activeNodes.map(link => { let rect = link.getBoundingClientRect(); - // Since the getBoundingClientRect is untransformed we cannot rely on it's size - // We need a transformed bottom right to calculate local width and height + // Since the getBoundingClientRect is untransformed we cannot rely on it's size + // We need a transformed bottom right to calculate local width and height let bottomRight = Points$1.fromPageToNode(element, { x: rect.x + rect.width, y: rect.y + rect.height @@ -6249,7 +6244,7 @@ /** Configuration object. Return default styles as CSS values. */ defaultStyle() { - let padding = this.padding; + this.padding; let style = { maxWidth: this.maxWidth + 'px', zIndex: this.zIndex, @@ -6528,7 +6523,7 @@ * @memberof Popup */ static targetCenter(event) { - let target = event.target; + event.target; let x = event.pageX; let y = event.pageY; let rect = Popup$1.targetRect(event); @@ -6651,9 +6646,14 @@ if (this.autoClose) { this.close(); } - setTimeout((event, key) => { - func(event, key); - }, 20, event, key); + setTimeout( + (event, key) => { + func(event, key); + }, + 20, + event, + key + ); } /** Update the menu item denoted by key. @@ -7569,7 +7569,7 @@ reorderArguments(params) { // first parameter //-------------------- - const element = params[0]; + params[0]; // other parameter //-------------------- @@ -8239,7 +8239,7 @@ let svg = 'http://www.w3.org/2000/svg'; let xlink = 'http://www.w3.org/1999/xlink'; - let svgGroup = element.parentNode; + element.parentNode; let src = image.getAttributeNS(xlink, 'href'); @@ -8572,7 +8572,7 @@ */ return html.replace( /<\s*(a|video|img|image|circle)\s(.*?)(xlink:href|href|src)\s*=\s*["'](\..*?)["']\s*(.*?)>/g, - function () { + function() { let path = that._getRelativePath(arguments[4]); const tag = `<${arguments[1]} ${arguments[2]} ${arguments[3]}="${path}" ${arguments[5]}>`; /* if (that.debug) */ console.log('Adjusted: ', tag); @@ -8601,7 +8601,7 @@ return new Promise((resolve, reject) => { let request = new XMLHttpRequest(); - request.onreadystatechange = function () { + request.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200 || Card._isLocal()) { try { @@ -9066,7 +9066,7 @@ let cx = target.getAttribute('cx'); let cy = target.getAttribute('cy'); let r = target.getAttribute('r'); - let radius = r.endsWith('%') ? (parseFloat(r) / 100) * width : parseFloat(r); + r.endsWith('%') ? (parseFloat(r) / 100) * width : parseFloat(r); let x = cx.endsWith('%') ? (parseFloat(cx) / 100) * width : cx; let y = cy.endsWith('%') ? (parseFloat(cy) / 100) * height : cx; @@ -9886,7 +9886,7 @@ }); }, onUpdateParams: ['{self}'], - onUpdate: function (self) { + onUpdate: function(self) { let transform = self.target._gsTransform; TweenLite.set(title, { diff --git a/dist/iwmlib.pixi.js b/dist/iwmlib.pixi.js index 039e2d1..1e8ba60 100644 --- a/dist/iwmlib.pixi.js +++ b/dist/iwmlib.pixi.js @@ -1515,7 +1515,7 @@ return new Date(date.getTime() + 1) } - static * iterYears(start, end) { + static *iterYears(start, end) { let date = this.create(start.getFullYear(), 0, 1); while (date <= end) { yield date; @@ -1524,7 +1524,7 @@ yield date; } - static * iterMonths(year, limit = 12) { + static *iterMonths(year, limit = 12) { let month = 0; while (month < limit) { let date = this.create(year.getFullYear(), month, 1); @@ -1533,7 +1533,7 @@ } } - static * iterMonthsOfYears(years) { + static *iterMonthsOfYears(years) { for (let year of years) { for (let month of this.iterMonths(year)) { yield month; @@ -1541,7 +1541,7 @@ } } - static * iterDays(month) { + static *iterDays(month) { let day = 1; let limit = Dates.daysInMonth(month); while (day <= limit) { @@ -1551,7 +1551,7 @@ } } - static * iterDaysOfMonths(months) { + static *iterDaysOfMonths(months) { for (let month of months) { for (let day of this.iterDays(month)) { yield day; @@ -1729,16 +1729,12 @@ static distanceToRect(p, r) { let dx = 0; let dy = 0; - if (p.x < r.x) - dx = p.x - r.x; - else if (p.x > r.x + r.width) - dx = p.x - (r.x + r.width); - if (p.y < r.y) - dy = p.y - r.y; - else if (p.y > r.y + r.height) - dy = p.y - (r.y + r.height); + if (p.x < r.x) dx = p.x - r.x; + else if (p.x > r.x + r.width) dx = p.x - (r.x + r.width); + if (p.y < r.y) dy = p.y - r.y; + else if (p.y > r.y + r.height) dy = p.y - (r.y + r.height); return Math.sqrt(dx * dx + dy * dy) - /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) + /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) let cy = Math.max(Math.min(p.y, r.y + r.height), r.y) let result = Math.sqrt((p.x - cx) * (p.x - cx) + (p.y - cy) * (p.y - cy)) console.log("distanceToRect", p, r, result) @@ -2210,11 +2206,11 @@ next(nextValue) { // push new value to the end, and remove oldest one let removed = this.__push(nextValue); - // smooth value using all values from buffer + // smooth value using all values from buffer let result = this.buffer.reduce((last, current) => { - return this.smoothing * current + (1 - this.smoothing) * last - }, removed); - // replace smoothed value + return this.smoothing * current + (1 - this.smoothing) * last + }, removed); + // replace smoothed value this.buffer[this.buffer.length - 1] = result; return result } @@ -3691,7 +3687,7 @@ * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. * @param {boolean} [opts.closeOnPopup=false] - Should the popup be closed when the user clicks on the popup? - * @param {boolean} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {object} [opts.button] - A Button object to be display on the lower right corner. * @param {object} [opts.buttonGroup] - A ButtonGroup object to be displayed on the lower right corner. */ @@ -3746,7 +3742,16 @@ // closeButton //----------------- if (this.opts.closeButton) { - let closeButton = PIXI.Sprite.from('../../assets/icons/close.png'); + let url = null; + if (typeof this.opts.closeButton === 'string' || this.opts.closeButton instanceof String) { + url = InteractivePopup.iconIsUrl(this.opts.closeButton) + ? this.opts.closeButton + : `../../assets/icons/${this.opts.closeButton}.png`; + } else { + url = '../../assets/icons/close.png'; + } + + let closeButton = PIXI.Sprite.from(url); closeButton.width = this.headerStyle.fontSize; closeButton.height = closeButton.width; closeButton.tint = this.theme.color2; @@ -3845,6 +3850,18 @@ return size } + + /** + * Tests if an icon string is an url. + * + * @private + * @static + * @param {string} url - The url to test. + * @return {boolean} true if the url is an url to an image. + */ + static iconIsUrl(url) { + return /\.(png|svg|gif|jpg|jpeg|tif|tiff)$/i.test(url) + } } /** @@ -3870,7 +3887,7 @@ * * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. - * @param {boolean} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {number} [opts.minWidth=0] - The minimum width of the popup. * @param {number} [opts.minHeight=0] - The minimum height of the popup. */ @@ -4595,7 +4612,7 @@ */ expandRenderer(expand = 256) { let renderer = this.renderer; - let resolution = this.renderer.resolution; + this.renderer.resolution; let ww = this.width; let hh = this.height; let sw = this.screen.width; @@ -5229,9 +5246,9 @@ static implementationError(klass) { let interfaceKeys = Reflect.ownKeys(this.prototype); - let classKeys = Reflect.ownKeys(klass.prototype); + Reflect.ownKeys(klass.prototype); for (let key of interfaceKeys) { - let interfaceDesc = this.prototype[key]; + this.prototype[key]; let classDesc = klass.prototype[key]; if (typeof classDesc == 'undefined') return 'Missing ' + key } @@ -7100,7 +7117,7 @@ // UO: since keepOnStage is called in nextVelocity we need to // ensure a return value if (!stagePolygon) return { x: 0, y: 0 } - let polygon = this.polygon; + this.polygon; let bounced = this.bouncing(); if (bounced) { let stage = this.containerBounds; @@ -8006,7 +8023,7 @@ isClickable(node) { if (node == null) return false - // console.log("isClickable", node, this.isClickPrevented(node)) + // console.log("isClickable", node, this.isClickPrevented(node)) if (this.isClickPrevented(node)) { return false } @@ -8053,8 +8070,8 @@ let clickRects = activeNodes.map(link => { let rect = link.getBoundingClientRect(); - // Since the getBoundingClientRect is untransformed we cannot rely on it's size - // We need a transformed bottom right to calculate local width and height + // Since the getBoundingClientRect is untransformed we cannot rely on it's size + // We need a transformed bottom right to calculate local width and height let bottomRight = Points.fromPageToNode(element, { x: rect.x + rect.width, y: rect.y + rect.height @@ -9884,7 +9901,7 @@ **/ setupTiles(center = false) { // First load background tile - let tiles = this.ensureAllTiles(this.currentLevel); + this.ensureAllTiles(this.currentLevel); if (center) { this.pivot.set(w / 2, h / 2); } @@ -10121,7 +10138,7 @@ let maxWidth = worldBounds.width; let maxHeight = worldBounds.height; - let pointInWindow = new PIXI.Point(); + new PIXI.Point(); let worldTopLeft = new PIXI.Point(worldBounds.x, worldBounds.y); let worldBottomRight = new PIXI.Point(worldBounds.x + maxWidth, worldBounds.y + maxHeight); let worldCenter = new PIXI.Point(worldBounds.x + maxWidth / 2, worldBounds.y + maxHeight / 2); @@ -10311,7 +10328,7 @@ untintTiles(level) { let key = level.toString(); if (key in this.tileLayers) { - let tiles = this.tileLayers[key]; + this.tileLayers[key]; } } @@ -10613,7 +10630,7 @@ load(domNode) { return new Promise((resolve, reject) => { let isImage = domNode instanceof HTMLImageElement; - let isSprite = this.scatter.displayObject instanceof PIXI.Sprite; + this.scatter.displayObject instanceof PIXI.Sprite; let image = isImage ? domNode : document.createElement('img'); let [x, y, w, h, cloneURL] = this.cloneScatterImage(); let [ww, hh] = this.unscaledSize(); @@ -11766,7 +11783,6 @@ if (y != null) this.y = y; } - getWorldScatter() { return this } @@ -11889,7 +11905,7 @@ let h2 = this.height / 2; let dist = Math.sqrt(w2 * w2 + h2 * h2); let angle = Points.angle({ x: w2, y: h2 }, { x: 0, y: 0 }); - let p = this.displayObject.x; + this.displayObject.x; let c = Points.arc(this.position, this.rotation + angle, dist); return c // Points.subtract(c, this.pivot) } @@ -13756,11 +13772,8 @@ ? false : this.scrollHeight > this.options.boxHeight; this.scrollbar.clear(); - let options = {}; - options.left = 0; - options.right = this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0); - options.top = 0; - options.bottom = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0); + this.scrollWidth + (this._isScrollbarVertical ? this.options.scrollbarSize : 0); + this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0); const width = this.scrollWidth + (this.isScrollbarVertical ? this.options.scrollbarSize : 0); const height = this.scrollHeight + (this.isScrollbarHorizontal ? this.options.scrollbarSize : 0); this.scrollbarTop = (this.content.top / height) * this.boxHeight; @@ -19510,14 +19523,11 @@ } _adaptCoordinates(map) { - let scale = 1; if (map instanceof DeepZoomMap) { - scale = map.image.scale.x; + map.image.scale.x; } - scale = scale / 4; - return map.coordinatesToPoint(this.coordinates) } @@ -21088,8 +21098,8 @@ if (myevent && myevent.submap) { const submap = myevent.submap; const center = submap.center; - const radius = submap.container.width / 2; - const distance = Points.distance(center, event.data.global) / submap.scatter.scale; + submap.container.width / 2; + Points.distance(center, event.data.global) / submap.scatter.scale; } } } diff --git a/doc/out/AbstractPopup.html b/doc/out/AbstractPopup.html index 943bec5..00e033f 100644 --- a/doc/out/AbstractPopup.html +++ b/doc/out/AbstractPopup.html @@ -709,36 +709,6 @@ -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3451,7 +3061,7 @@ like Popup, Message, Tooltip...

    @@ -4899,7 +4509,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/Badge.html b/doc/out/Badge.html index 5b72951..90d9921 100644 --- a/doc/out/Badge.html +++ b/doc/out/Badge.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4355,7 +3965,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/BlurFilter.html b/doc/out/BlurFilter.html index 2c74cd7..337f091 100644 --- a/doc/out/BlurFilter.html +++ b/doc/out/BlurFilter.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3453,7 +3063,7 @@ is assigned to!

    @@ -3779,7 +3389,7 @@ app.scene.filters = [blurFilter]
    diff --git a/doc/out/Button.html b/doc/out/Button.html index a2410b8..2d5a2b7 100644 --- a/doc/out/Button.html +++ b/doc/out/Button.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -5428,7 +5038,7 @@ the tint property of the icon sprite.

    @@ -5552,7 +5162,7 @@ the tint property of the icon sprite.

    @@ -5657,7 +5267,7 @@ the tint property of the icon sprite.

    @@ -5762,7 +5372,7 @@ the tint property of the icon sprite.

    @@ -5869,7 +5479,7 @@ the tint property of the icon sprite.

    diff --git a/doc/out/ButtonGroup.html b/doc/out/ButtonGroup.html index 9217f82..2350532 100644 --- a/doc/out/ButtonGroup.html +++ b/doc/out/ButtonGroup.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -5631,7 +5241,7 @@ app.scene.addChild(buttonGroup)
    diff --git a/doc/out/DeepZoomImage.html b/doc/out/DeepZoomImage.html index ca3b559..69d2e4c 100644 --- a/doc/out/DeepZoomImage.html +++ b/doc/out/DeepZoomImage.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3453,7 +3063,7 @@ more detailed tiles at the larger level as fast as possible.

    @@ -7077,7 +6687,7 @@ i.e. after loading a single tile

    diff --git a/doc/out/DeepZoomInfo.html b/doc/out/DeepZoomInfo.html index a61be34..50888d9 100644 --- a/doc/out/DeepZoomInfo.html +++ b/doc/out/DeepZoomInfo.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3450,7 +3060,7 @@ height and width of the overall image, overlap, and image type.

    @@ -4590,7 +4200,7 @@ on completion.

    diff --git a/doc/out/Flippable.html b/doc/out/Flippable.html index d620670..bf82296 100644 --- a/doc/out/Flippable.html +++ b/doc/out/Flippable.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4493,7 +4103,7 @@ front.on('click', event => flippable.toggle())
    diff --git a/doc/out/FontInfo.html b/doc/out/FontInfo.html index 35e3717..0c55d15 100644 --- a/doc/out/FontInfo.html +++ b/doc/out/FontInfo.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3540,7 +3150,7 @@
    diff --git a/doc/out/Hypenate.html b/doc/out/Hypenate.html index e1a7d62..f30ece8 100644 --- a/doc/out/Hypenate.html +++ b/doc/out/Hypenate.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3742,7 +3352,7 @@
    diff --git a/doc/out/InteractivePopup.html b/doc/out/InteractivePopup.html index 35b18f4..6e96611 100644 --- a/doc/out/InteractivePopup.html +++ b/doc/out/InteractivePopup.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3451,7 +3061,7 @@ like Popup, Message...

    @@ -3584,6 +3194,9 @@ like Popup, Message...

    boolean +| + +string @@ -3606,7 +3219,7 @@ like Popup, Message...

    -

    Should a close button be displayed on the upper right corner?

    +

    Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified.

    @@ -4056,7 +3669,7 @@ a string, a number or a PIXI.Text object.

    @@ -4324,7 +3937,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/LabeledGraphics.exports.LabeledGraphics.html b/doc/out/LabeledGraphics.exports.LabeledGraphics.html index 61f7c63..7429c2c 100644 --- a/doc/out/LabeledGraphics.exports.LabeledGraphics.html +++ b/doc/out/LabeledGraphics.exports.LabeledGraphics.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3542,7 +3152,7 @@
    diff --git a/doc/out/LabeledGraphics.html b/doc/out/LabeledGraphics.html index 7c113b7..1b686de 100644 --- a/doc/out/LabeledGraphics.html +++ b/doc/out/LabeledGraphics.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -4607,7 +4217,7 @@ than wanted

    diff --git a/doc/out/List.html b/doc/out/List.html index 5f24cd3..e5dec67 100644 --- a/doc/out/List.html +++ b/doc/out/List.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4566,7 +4176,7 @@ app.scene.addChild(list)
    diff --git a/doc/out/Message.html b/doc/out/Message.html index 24d16eb..6d2a94b 100644 --- a/doc/out/Message.html +++ b/doc/out/Message.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4000,16 +3610,6 @@ app.scene.addChild(button) -

    Classes

    - -
    -
    InteractivePopup
    - - -
    InteractivePopup
    - -
    - @@ -4422,7 +4022,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/Modal.html b/doc/out/Modal.html index 0f4ffab..7d5e1b8 100644 --- a/doc/out/Modal.html +++ b/doc/out/Modal.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -3852,16 +3462,6 @@ app.scene.addChild(button) -

    Classes

    - -
    -
    InteractivePopup
    - - -
    InteractivePopup
    - -
    - @@ -4323,7 +3923,7 @@ a string or a PIXI.Text object.

    diff --git a/doc/out/PIXIApp.html b/doc/out/PIXIApp.html index 9ae4f27..bf69e3a 100644 --- a/doc/out/PIXIApp.html +++ b/doc/out/PIXIApp.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3450,7 +3060,7 @@ by several functions and makes meaningful pre-assumptions.

    @@ -7724,7 +7334,7 @@ rejected with an error.
    diff --git a/doc/out/Popup.html b/doc/out/Popup.html index f1d0768..6ceddde 100644 --- a/doc/out/Popup.html +++ b/doc/out/Popup.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -3546,6 +3156,9 @@ boolean +| + +string @@ -3568,7 +3181,7 @@ -

    Should a close button be displayed on the upper right corner?

    +

    Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified.

    @@ -3732,16 +3345,6 @@ app.scene.addChild(popup) -

    Classes

    - -
    -
    InteractivePopup
    - - -
    InteractivePopup
    - -
    - @@ -4049,7 +3652,7 @@ a string, a number or a PIXI.Text object.

    @@ -4317,7 +3920,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/PopupMenu.html b/doc/out/PopupMenu.html index 06a0999..0ea5e6f 100644 --- a/doc/out/PopupMenu.html +++ b/doc/out/PopupMenu.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -3780,22 +3390,6 @@ app.scene.addChild(button) -

    Classes

    - -
    -
    InteractivePopup
    - - -
    InteractivePopup
    - - -
    InteractivePopup
    - - -
    InteractivePopup
    - -
    - @@ -4103,7 +3697,7 @@ a string, a number or a PIXI.Text object.

    @@ -4371,7 +3965,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/Progress.html b/doc/out/Progress.html index d7ace92..5db199f 100644 --- a/doc/out/Progress.html +++ b/doc/out/Progress.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4856,7 +4466,7 @@ app.scene.addChild(progress)
    diff --git a/doc/out/Scrollview.html b/doc/out/Scrollview.html index 60fc326..8e2530a 100644 --- a/doc/out/Scrollview.html +++ b/doc/out/Scrollview.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -3492,7 +3102,9 @@
    See:
    @@ -3688,7 +3300,7 @@ app.loader
    diff --git a/doc/out/Slider.html b/doc/out/Slider.html index f26b60f..fa48865 100644 --- a/doc/out/Slider.html +++ b/doc/out/Slider.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4947,7 +4557,7 @@ app.scene.addChild(slider)
    diff --git a/doc/out/Switch.html b/doc/out/Switch.html index 7159236..92e9365 100644 --- a/doc/out/Switch.html +++ b/doc/out/Switch.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -5377,7 +4987,7 @@ app.scene.addChild(switch1)
    diff --git a/doc/out/TextLabel.TextLabel.html b/doc/out/TextLabel.TextLabel.html index 8aaad05..c4ef827 100644 --- a/doc/out/TextLabel.TextLabel.html +++ b/doc/out/TextLabel.TextLabel.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3671,7 +3281,7 @@
    diff --git a/doc/out/Theme.html b/doc/out/Theme.html index 933ba0e..5a9e356 100644 --- a/doc/out/Theme.html +++ b/doc/out/Theme.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -5218,7 +4828,7 @@ const app = new PIXIApp({
    diff --git a/doc/out/ThemeDark.html b/doc/out/ThemeDark.html index 7f4992a..366e0ac 100644 --- a/doc/out/ThemeDark.html +++ b/doc/out/ThemeDark.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3567,7 +3177,7 @@ const app = new PIXIApp({
    diff --git a/doc/out/ThemeLight.html b/doc/out/ThemeLight.html index f1ffc42..24973ab 100644 --- a/doc/out/ThemeLight.html +++ b/doc/out/ThemeLight.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3450,7 +3060,7 @@ The color1 is set to 0xf6f6f6, color2 to 0x282828.

    @@ -3579,7 +3189,7 @@ const app = new PIXIApp({
    diff --git a/doc/out/ThemeRed.html b/doc/out/ThemeRed.html index 4784c1c..7b62fd2 100644 --- a/doc/out/ThemeRed.html +++ b/doc/out/ThemeRed.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3450,7 +3060,7 @@ The primaryColor is set to 0xd92f31.

    @@ -3579,7 +3189,7 @@ const app = new PIXIApp({
    diff --git a/doc/out/TileQuadNode.html b/doc/out/TileQuadNode.html index b987b43..4532f80 100644 --- a/doc/out/TileQuadNode.html +++ b/doc/out/TileQuadNode.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3456,7 +3066,7 @@ the memory pressure.

    @@ -4031,7 +3641,7 @@ an indicator of tiles to free.

    diff --git a/doc/out/Tooltip.html b/doc/out/Tooltip.html index 660696e..21a84d1 100644 --- a/doc/out/Tooltip.html +++ b/doc/out/Tooltip.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4493,7 +4103,7 @@ a string, a number or a PIXI.Text object.

    diff --git a/doc/out/UITest.html b/doc/out/UITest.html index c340f7d..708d6c9 100644 --- a/doc/out/UITest.html +++ b/doc/out/UITest.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -6164,7 +5774,7 @@ test.start()
    diff --git a/doc/out/Volatile.html b/doc/out/Volatile.html index b1236d0..adc1be3 100644 --- a/doc/out/Volatile.html +++ b/doc/out/Volatile.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3449,7 +3059,7 @@ @@ -4080,7 +3690,7 @@ app.scene.addChild(button)
    diff --git a/doc/out/global.html b/doc/out/global.html index 572ee60..76249e4 100644 --- a/doc/out/global.html +++ b/doc/out/global.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -6057,7 +5667,7 @@ instead of pixel values, where x represents the latitude and y the longitude.

    diff --git a/doc/out/index.html b/doc/out/index.html index 7713540..da01e1e 100644 --- a/doc/out/index.html +++ b/doc/out/index.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3462,7 +3072,7 @@
    diff --git a/doc/out/pixi_abstractpopup.js.html b/doc/out/pixi_abstractpopup.js.html index b493dc8..42b9315 100644 --- a/doc/out/pixi_abstractpopup.js.html +++ b/doc/out/pixi_abstractpopup.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3785,7 +3395,7 @@ export default class AbstractPopup extends PIXI.Graphics {
    diff --git a/doc/out/pixi_app.js.html b/doc/out/pixi_app.js.html index d908990..58cae7e 100644 --- a/doc/out/pixi_app.js.html +++ b/doc/out/pixi_app.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -4165,7 +3775,7 @@ class FpsDisplay extends PIXI.Graphics {
    diff --git a/doc/out/pixi_badge.js.html b/doc/out/pixi_badge.js.html index 1a05920..6edf3e5 100644 --- a/doc/out/pixi_badge.js.html +++ b/doc/out/pixi_badge.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3546,7 +3156,7 @@ export default class Badge extends AbstractPopup {
    diff --git a/doc/out/pixi_blurfilter.js.html b/doc/out/pixi_blurfilter.js.html index 9ec87fb..3c77ab0 100644 --- a/doc/out/pixi_blurfilter.js.html +++ b/doc/out/pixi_blurfilter.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3710,7 +3320,7 @@ class TiltShiftYFilter extends TiltShiftAxisFilter {
    diff --git a/doc/out/pixi_button.js.html b/doc/out/pixi_button.js.html index 0c2326c..32caddd 100644 --- a/doc/out/pixi_button.js.html +++ b/doc/out/pixi_button.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3536,6 +3146,8 @@ export default class Button extends PIXI.Container { const theme = Theme.fromString(opts.theme) this.theme = theme + this.HIDDEN_ALPHA = 0.000000001 // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction + this.opts = Object.assign( {}, { @@ -3595,10 +3207,10 @@ export default class Button extends PIXI.Container { if (this.opts.style === 'link') { Object.assign(this.opts, { - strokeAlpha: 0, - strokeActiveAlpha: 0, - fillAlpha: 0, - fillActiveAlpha: 0 + strokeAlpha: this.HIDDEN_ALPHA, + strokeActiveAlpha: this.HIDDEN_ALPHA, + fillAlpha: this.HIDDEN_ALPHA, + fillActiveAlpha: this.HIDDEN_ALPHA }) } @@ -3709,10 +3321,6 @@ export default class Button extends PIXI.Container { this.opts.beforeAction.call(this, e, this) } - if (this.opts.action) { - this.opts.action.call(this, e, this) - } - TweenLite.to([this.button, this.content], this.theme.fast, { alpha: 0.83, overwrite: 'none' @@ -3722,6 +3330,10 @@ export default class Button extends PIXI.Container { this.active = !this.active } + if (this.opts.action) { + this.opts.action.call(this, e, this) + } + if (this.opts.afterAction) { this.opts.afterAction.call(this, e, this) } @@ -4063,8 +3675,8 @@ export default class Button extends PIXI.Container { hide() { this.opts.strokeAlpha = 0.0 this.opts.strokeActiveAlpha = 0.0 - this.opts.fillAlpha = 0.0000000001 // WORKAROUND: See https://github.com/pixijs/pixi.js/wiki/v5-Migration-Guide#graphics-interaction - this.opts.fillActiveAlpha = 0.0000000001 + this.opts.fillAlpha = this.HIDDEN_ALPHA + this.opts.fillActiveAlpha = this.HIDDEN_ALPHA this.layout() @@ -4154,7 +3766,7 @@ export default class Button extends PIXI.Container {
    diff --git a/doc/out/pixi_buttongroup.js.html b/doc/out/pixi_buttongroup.js.html index a6e7fda..1ac3a7f 100644 --- a/doc/out/pixi_buttongroup.js.html +++ b/doc/out/pixi_buttongroup.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -4157,7 +3767,7 @@ export default class ButtonGroup extends PIXI.Container {
    diff --git a/doc/out/pixi_deepzoom_image.js.html b/doc/out/pixi_deepzoom_image.js.html index 0830af1..49ec7f3 100644 --- a/doc/out/pixi_deepzoom_image.js.html +++ b/doc/out/pixi_deepzoom_image.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -4489,7 +4099,7 @@ export class DeepZoomImage extends PIXI.Container {
    diff --git a/doc/out/pixi_flippable.js.html b/doc/out/pixi_flippable.js.html index 0db6dd9..b74a5ec 100644 --- a/doc/out/pixi_flippable.js.html +++ b/doc/out/pixi_flippable.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3883,7 +3493,7 @@ export default class Flippable extends PIXI.projection.Camera3d {
    diff --git a/doc/out/pixi_labeledgraphics.js.html b/doc/out/pixi_labeledgraphics.js.html index d27b656..88fd011 100644 --- a/doc/out/pixi_labeledgraphics.js.html +++ b/doc/out/pixi_labeledgraphics.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3832,7 +3442,7 @@ export class BitmapLabeledGraphics extends LabeledGraphics {
    diff --git a/doc/out/pixi_list.js.html b/doc/out/pixi_list.js.html index 8c676c8..fe2fe94 100644 --- a/doc/out/pixi_list.js.html +++ b/doc/out/pixi_list.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3811,7 +3421,7 @@ export default class List extends PIXI.Container {
    diff --git a/doc/out/pixi_message.js.html b/doc/out/pixi_message.js.html index 1a95c1e..a7d4921 100644 --- a/doc/out/pixi_message.js.html +++ b/doc/out/pixi_message.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3560,7 +3170,7 @@ export default class Message extends InteractivePopup {
    diff --git a/doc/out/pixi_modal.js.html b/doc/out/pixi_modal.js.html index f063849..faf6aab 100644 --- a/doc/out/pixi_modal.js.html +++ b/doc/out/pixi_modal.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3641,7 +3251,7 @@ export default class Modal extends PIXI.Container {
    diff --git a/doc/out/pixi_popup.js.html b/doc/out/pixi_popup.js.html index a7e461c..99d9828 100644 --- a/doc/out/pixi_popup.js.html +++ b/doc/out/pixi_popup.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3441,7 +3051,7 @@ export class InteractivePopup extends AbstractPopup { * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. * @param {boolean} [opts.closeOnPopup=false] - Should the popup be closed when the user clicks on the popup? - * @param {boolean} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {object} [opts.button] - A Button object to be display on the lower right corner. * @param {object} [opts.buttonGroup] - A ButtonGroup object to be displayed on the lower right corner. */ @@ -3496,7 +3106,16 @@ export class InteractivePopup extends AbstractPopup { // closeButton //----------------- if (this.opts.closeButton) { - let closeButton = PIXI.Sprite.from('../../assets/icons/close.png') + let url = null + if (typeof this.opts.closeButton === 'string' || this.opts.closeButton instanceof String) { + url = InteractivePopup.iconIsUrl(this.opts.closeButton) + ? this.opts.closeButton + : `../../assets/icons/${this.opts.closeButton}.png` + } else { + url = '../../assets/icons/close.png' + } + + let closeButton = PIXI.Sprite.from(url) closeButton.width = this.headerStyle.fontSize closeButton.height = closeButton.width closeButton.tint = this.theme.color2 @@ -3595,6 +3214,18 @@ export class InteractivePopup extends AbstractPopup { return size } + + /** + * Tests if an icon string is an url. + * + * @private + * @static + * @param {string} url - The url to test. + * @return {boolean} true if the url is an url to an image. + */ + static iconIsUrl(url) { + return /\.(png|svg|gif|jpg|jpeg|tif|tiff)$/i.test(url) + } } /** @@ -3620,7 +3251,7 @@ export default class Popup extends InteractivePopup { * * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. - * @param {boolean} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {number} [opts.minWidth=0] - The minimum width of the popup. * @param {number} [opts.minHeight=0] - The minimum height of the popup. */ @@ -3651,7 +3282,7 @@ export default class Popup extends InteractivePopup {
    diff --git a/doc/out/pixi_popupmenu.js.html b/doc/out/pixi_popupmenu.js.html index 053e883..0f1b3ee 100644 --- a/doc/out/pixi_popupmenu.js.html +++ b/doc/out/pixi_popupmenu.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3554,7 +3164,7 @@ export default class PopupMenu extends Popup {
    diff --git a/doc/out/pixi_progress.js.html b/doc/out/pixi_progress.js.html index 1f81e23..4524bdb 100644 --- a/doc/out/pixi_progress.js.html +++ b/doc/out/pixi_progress.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3736,7 +3346,7 @@ export default class Progress extends PIXI.Container {
    diff --git a/doc/out/pixi_scrollview.js.html b/doc/out/pixi_scrollview.js.html index 2895b7d..1a0411d 100644 --- a/doc/out/pixi_scrollview.js.html +++ b/doc/out/pixi_scrollview.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3495,7 +3105,7 @@ export default class Scrollview extends Scrollbox {
    diff --git a/doc/out/pixi_slider.js.html b/doc/out/pixi_slider.js.html index cc9a259..352583e 100644 --- a/doc/out/pixi_slider.js.html +++ b/doc/out/pixi_slider.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3900,7 +3510,7 @@ export default class Slider extends PIXI.Container {
    diff --git a/doc/out/pixi_switch.js.html b/doc/out/pixi_switch.js.html index 68777ad..26dd6b2 100644 --- a/doc/out/pixi_switch.js.html +++ b/doc/out/pixi_switch.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3954,7 +3564,7 @@ export default class Switch extends PIXI.Container {
    diff --git a/doc/out/pixi_theme.js.html b/doc/out/pixi_theme.js.html index 2d4822a..42ff975 100644 --- a/doc/out/pixi_theme.js.html +++ b/doc/out/pixi_theme.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3699,7 +3309,7 @@ export class ThemeRed extends Theme {
    diff --git a/doc/out/pixi_tooltip.js.html b/doc/out/pixi_tooltip.js.html index 7f0dfb1..6f9ca3c 100644 --- a/doc/out/pixi_tooltip.js.html +++ b/doc/out/pixi_tooltip.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3588,7 +3198,7 @@ export default class Tooltip extends AbstractPopup {
    diff --git a/doc/out/pixi_volatile.js.html b/doc/out/pixi_volatile.js.html index b7384c6..2ec3d2e 100644 --- a/doc/out/pixi_volatile.js.html +++ b/doc/out/pixi_volatile.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -3592,7 +3202,7 @@ export default class Volatile {
    diff --git a/doc/out/uitest.js.html b/doc/out/uitest.js.html index f63bb24..8407750 100644 --- a/doc/out/uitest.js.html +++ b/doc/out/uitest.js.html @@ -709,36 +709,6 @@
  • -
  • - - - - DeepZoomMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -783,36 +753,6 @@
  • -
  • - - - - DeepZoomMapProjectionMapProjection - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -1695,36 +1635,6 @@
  • -
  • - - - - ImageMapGeoMap - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2319,66 +2229,6 @@
  • -
  • - - - - MessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - MessageMessageInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2423,66 +2273,6 @@
  • -
  • - - - - ModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - ModalModalInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2661,36 +2451,6 @@
  • -
  • - - - - PopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -2735,156 +2495,6 @@
  • -
  • - - - - PopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupMenuPopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • - -
  • - - - - PopupPopupInteractivePopup - - - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
      - -
    - -
  • -
  • @@ -4443,7 +4053,7 @@ class Event { diff --git a/lib/card/card.js b/lib/card/card.js index 9c83892..c08ae86 100644 --- a/lib/card/card.js +++ b/lib/card/card.js @@ -269,7 +269,7 @@ export default class Card { */ return html.replace( /<\s*(a|video|img|image|circle)\s(.*?)(xlink:href|href|src)\s*=\s*["'](\..*?)["']\s*(.*?)>/g, - function () { + function() { let path = that._getRelativePath(arguments[4]) const tag = `<${arguments[1]} ${arguments[2]} ${arguments[3]}="${path}" ${arguments[5]}>` /* if (that.debug) */ console.log('Adjusted: ', tag) @@ -298,7 +298,7 @@ export default class Card { return new Promise((resolve, reject) => { let request = new XMLHttpRequest() - request.onreadystatechange = function () { + request.onreadystatechange = function() { if (this.readyState == 4) { if (this.status == 200 || Card._isLocal()) { try { @@ -1593,7 +1593,7 @@ export default class Card { }) }, onUpdateParams: ['{self}'], - onUpdate: function (self) { + onUpdate: function(self) { let transform = self.target._gsTransform TweenLite.set(title, { diff --git a/lib/card/wrapper.js b/lib/card/wrapper.js index cf63ab4..a3a02b9 100644 --- a/lib/card/wrapper.js +++ b/lib/card/wrapper.js @@ -54,7 +54,7 @@ export default class CardWrapper extends Object { isClickable(node) { if (node == null) return false - // console.log("isClickable", node, this.isClickPrevented(node)) + // console.log("isClickable", node, this.isClickPrevented(node)) if (this.isClickPrevented(node)) { return false } @@ -101,8 +101,8 @@ export default class CardWrapper extends Object { let clickRects = activeNodes.map(link => { let rect = link.getBoundingClientRect() - // Since the getBoundingClientRect is untransformed we cannot rely on it's size - // We need a transformed bottom right to calculate local width and height + // Since the getBoundingClientRect is untransformed we cannot rely on it's size + // We need a transformed bottom right to calculate local width and height let bottomRight = Points.fromPageToNode(element, { x: rect.x + rect.width, y: rect.y + rect.height @@ -200,4 +200,4 @@ export default class CardWrapper extends Object { this.tapNodes.set(objOrSelector, handler) } } -} \ No newline at end of file +} diff --git a/lib/errors.js b/lib/errors.js index 9b11cf1..91f43cc 100755 --- a/lib/errors.js +++ b/lib/errors.js @@ -117,10 +117,10 @@ export default class Errors { window.addEventListener( 'error', event => { - if (typeof(event.error) == 'undefined') { + if (typeof event.error == 'undefined') { // This sometimes happens in Edge. Since we have no error // position, we cannot do much beside an info log. - console.info("Catched undefined error", event) + console.info('Catched undefined error', event) return } this.appendError(event.error, event.filename) diff --git a/lib/pixi/popup.js b/lib/pixi/popup.js index 7be864e..09fdaef 100644 --- a/lib/pixi/popup.js +++ b/lib/pixi/popup.js @@ -18,7 +18,7 @@ export class InteractivePopup extends AbstractPopup { * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. * @param {boolean} [opts.closeOnPopup=false] - Should the popup be closed when the user clicks on the popup? - * @param {boolean} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=true] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {object} [opts.button] - A Button object to be display on the lower right corner. * @param {object} [opts.buttonGroup] - A ButtonGroup object to be displayed on the lower right corner. */ @@ -73,7 +73,16 @@ export class InteractivePopup extends AbstractPopup { // closeButton //----------------- if (this.opts.closeButton) { - let closeButton = PIXI.Sprite.from('../../assets/icons/close.png') + let url = null + if (typeof this.opts.closeButton === 'string' || this.opts.closeButton instanceof String) { + url = InteractivePopup.iconIsUrl(this.opts.closeButton) + ? this.opts.closeButton + : `../../assets/icons/${this.opts.closeButton}.png` + } else { + url = '../../assets/icons/close.png' + } + + let closeButton = PIXI.Sprite.from(url) closeButton.width = this.headerStyle.fontSize closeButton.height = closeButton.width closeButton.tint = this.theme.color2 @@ -172,6 +181,18 @@ export class InteractivePopup extends AbstractPopup { return size } + + /** + * Tests if an icon string is an url. + * + * @private + * @static + * @param {string} url - The url to test. + * @return {boolean} true if the url is an url to an image. + */ + static iconIsUrl(url) { + return /\.(png|svg|gif|jpg|jpeg|tif|tiff)$/i.test(url) + } } /** @@ -197,7 +218,7 @@ export default class Popup extends InteractivePopup { * * @constructor * @param {object} [opts] - An options object to specify to style and behaviour of the popup. - * @param {boolean} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? + * @param {boolean|string} [opts.closeButton=false] - Should a close button be displayed on the upper right corner? Alternatively, a URL to the image can be specified. * @param {number} [opts.minWidth=0] - The minimum width of the popup. * @param {number} [opts.minHeight=0] - The minimum height of the popup. */ diff --git a/lib/pixi/scatter.js b/lib/pixi/scatter.js index e671fba..3f00237 100755 --- a/lib/pixi/scatter.js +++ b/lib/pixi/scatter.js @@ -315,7 +315,6 @@ export class DisplayObjectScatter extends AbstractScatter { if (y != null) this.y = y } - getWorldScatter() { return this } diff --git a/lib/popupmenu.js b/lib/popupmenu.js index 9505cbf..402e0a0 100644 --- a/lib/popupmenu.js +++ b/lib/popupmenu.js @@ -113,9 +113,14 @@ export default class PopupMenu extends Popup { if (this.autoClose) { this.close() } - setTimeout((event, key) => { - func(event, key) - }, 20, event, key) + setTimeout( + (event, key) => { + func(event, key) + }, + 20, + event, + key + ) } /** Update the menu item denoted by key. diff --git a/lib/utils.js b/lib/utils.js index 13021a0..f8c243d 100755 --- a/lib/utils.js +++ b/lib/utils.js @@ -184,7 +184,7 @@ export class Dates { return new Date(date.getTime() + 1) } - static * iterYears(start, end) { + static *iterYears(start, end) { let date = this.create(start.getFullYear(), 0, 1) while (date <= end) { yield date @@ -193,7 +193,7 @@ export class Dates { yield date } - static * iterMonths(year, limit = 12) { + static *iterMonths(year, limit = 12) { let month = 0 while (month < limit) { let date = this.create(year.getFullYear(), month, 1) @@ -202,7 +202,7 @@ export class Dates { } } - static * iterMonthsOfYears(years) { + static *iterMonthsOfYears(years) { for (let year of years) { for (let month of this.iterMonths(year)) { yield month @@ -210,7 +210,7 @@ export class Dates { } } - static * iterDays(month) { + static *iterDays(month) { let day = 1 let limit = Dates.daysInMonth(month) while (day <= limit) { @@ -220,7 +220,7 @@ export class Dates { } } - static * iterDaysOfMonths(months) { + static *iterDaysOfMonths(months) { for (let month of months) { for (let day of this.iterDays(month)) { yield day @@ -398,16 +398,12 @@ export class Points { static distanceToRect(p, r) { let dx = 0 let dy = 0 - if (p.x < r.x) - dx = p.x - r.x - else if (p.x > r.x + r.width) - dx = p.x - (r.x + r.width) - if (p.y < r.y) - dy = p.y - r.y - else if (p.y > r.y + r.height) - dy = p.y - (r.y + r.height) + if (p.x < r.x) dx = p.x - r.x + else if (p.x > r.x + r.width) dx = p.x - (r.x + r.width) + if (p.y < r.y) dy = p.y - r.y + else if (p.y > r.y + r.height) dy = p.y - (r.y + r.height) return Math.sqrt(dx * dx + dy * dy) - /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) + /* let cx = Math.max(Math.min(p.x, r.x + r.width), r.x) let cy = Math.max(Math.min(p.y, r.y + r.height), r.y) let result = Math.sqrt((p.x - cx) * (p.x - cx) + (p.y - cy) * (p.y - cy)) console.log("distanceToRect", p, r, result) @@ -451,8 +447,7 @@ export class Sets { const i = sets.reduce((m, s, i) => (s.size < sets[m].size ? i : m), 0) const [smallest] = sets.splice(i, 1) const res = new Set() - for (let val of smallest) - if (sets.every(s => s.has(val))) res.add(val) + for (let val of smallest) if (sets.every(s => s.has(val))) res.add(val) return res } @@ -1001,11 +996,11 @@ export class LowPassFilter { next(nextValue) { // push new value to the end, and remove oldest one let removed = this.__push(nextValue) - // smooth value using all values from buffer + // smooth value using all values from buffer let result = this.buffer.reduce((last, current) => { - return this.smoothing * current + (1 - this.smoothing) * last - }, removed) - // replace smoothed value + return this.smoothing * current + (1 - this.smoothing) * last + }, removed) + // replace smoothed value this.buffer[this.buffer.length - 1] = result return result } @@ -1026,4 +1021,4 @@ export class LowPassFilter { } return values } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 50c1b93..a1511ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iwmlib", - "version": "1.1.0", + "version": "1.1.1", "description": "An Open Source library for multi-touch, WebGL powered applications.", "main": "index.js", "directories": {